Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 rifling through the Monastery: (6)
As of 2014-10-21 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (98 votes), past polls