LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-19-2005, 03:28 PM   #1
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Rep: Reputation: 32
perl: what does the hyphen in function call params mean?


In Perl, what does that hyphen (dash, minus sign) mean when
placed before function arguments?

For example, used with PerlTk:

$menubar = $top->Frame->pack(-side => "top", -fill => "x");

I know that => is just a pretty comma :), but I've never seen the
hyphen usage explained anywhere.

Thanks,
---John

Last edited by johnMG; 08-19-2005 at 03:30 PM.
 
Old 08-19-2005, 03:59 PM   #2
puffinman
Member
 
Registered: Jan 2005
Location: Atlanta, GA
Distribution: Gentoo, Slackware
Posts: 217

Rep: Reputation: 31
It doesn't mean anything. In the => hash syntax, it is not only just a pretty comma, it also automatically quotes the expression on the left of the arrow. So the following lines are all equivalent:

Code:
$menubar = $top->Frame->pack(-side => "top", -fill => "x");
$menubar = $top->Frame->pack("-side" => "top", "-fill" => "x");
$menubar = $top->Frame->pack("-side", "top", "-fill", "x");
So the leading hyphen is nothing more than a character. I think it is just the choice of the programmer of the package you are using as to what to call the various options. With Tk it may just be for compatibility with non-Perl usage.
 
Old 08-19-2005, 04:17 PM   #3
johnMG
Member
 
Registered: Jul 2003
Location: CT, USA
Distribution: Debian Sarge (server), Etch (work/home)
Posts: 601

Original Poster
Rep: Reputation: 32
Thanks puffinman!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call another function from a function? geminigal Programming 4 04-21-2005 10:41 PM
No Matching Function for Call ! vipinsharma Programming 2 07-05-2004 01:58 PM
what are the Hexadecimal function and ASCII function in Perl Bassam Programming 1 06-03-2004 01:44 AM
Perl exec function in linux (and system-function) nazula Programming 1 04-19-2004 12:21 PM
how to call function?? harpal Programming 3 04-29-2003 05:59 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration