Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Returning two lists from a sub

by Sidhekin (Priest)
on Jun 07, 2007 at 14:50 UTC ( #619822=note: print w/ replies, xml ) Need Help??


in reply to Returning two lists from a sub

There is just one return list.

In the spirit of horrible solutions, you could pass the second one out-of-band. Right. But there's no sane reason to do that, is there?

So, in the spirit of insane solutions, have one more:

use strict; use warnings; sub getlists(\@\@); getlists( my @a, my @b ); print join(" ",@a),"\n",join(" ",@b); sub getlists(\@\@) { my ($foo, $bar) = @_; @$foo = (1,2,3); @$bar = (4,5,6); }

Most horrible yet? ;-)

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!


Comment on Re: Returning two lists from a sub
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2015-07-31 02: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 (274 votes), past polls