Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://619822]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2018-06-25 10:52 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.