Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: my $x or my ($x)

by xorl (Deacon)
on Apr 04, 2006 at 12:13 UTC ( #541135=note: print w/ replies, xml ) Need Help??


in reply to my $x or my ($x)

In addition to the above, the list context can be useful in a case like this:

my ($foo, $bar, $baz) = return_an_array(); print "Foo: $foo, BAR: $bar, BAZ: $baz"; sub return_an_array() { my @the_array = ("1","apple","a"); return @the_array; }
Will print
Foo: 1, BAR: apple, BAZ: a

Update: added $baz in the correct place. Thanks blogical.


Comment on Re: my $x or my ($x)
Download Code
Replies are listed 'Best First'.
Re^2: my $x or my ($x)
by blogical (Pilgrim) on Apr 04, 2006 at 17:49 UTC
    Or it would, if you asked for $baz. As it is it simply discards the third return item, 'a'.

    "One is enough. If you are acquainted with the principle, what do you care for the myriad instances and applications?"
    - Henry David Thoreau, Walden

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://541135]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-08-01 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls