Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Arrays and Scalar Parameters

by IraTarball (Monk)
on Aug 20, 2001 at 22:51 UTC ( #106309=note: print w/replies, xml ) Need Help??


in reply to Arrays and Scalar Parameters

I believe that the problem here, as alluded to in Sifmole's post, is that the values are all being returned as a single list. It might be safest to use references as Sifmole says, but for something like what you have here you can get away with just changing the order of the return data.
use strict; use warnings; sub getStuff { return 6, qw(one two three four five six) } my ($thing, @list) = getStuff(); print "my thing is $thing\n"; print "my list is @list\n";
This prints out:
$ perl list.pl my thing is 6 my list is one two three four five six

Hope this helps,
Ira,

"So... What do all these little arrows mean?"
~unknown

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2019-05-26 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (153 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!