Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Returning two arrays..

by tstock (Curate)
on Jan 04, 2002 at 09:14 UTC ( [id://136219]=note: print w/replies, xml ) Need Help??


in reply to Returning two arrays..

You can't return two arrays since functions only return lists, but you can return a list with two (or more) array references. In its most readable format it would look something like this:

sub mySub { my $array_ref1 = \@array1; my $array_ref2 = \@array2; return ($array_ref1, $array_ref2); } my ($arr_ref1, $arr_ref2) = mySub(); my @array_ref1 = @{$arr_ref1}; my @array_ref2 = @{$arr_ref2};

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-25 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found