Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2015-11-28 20:21 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (744 votes), past polls