in reply to Returning two lists from a sub
getlists(\@a, \@b); print join(" ",@a),"\n",join(" ",@b); sub getlists { my @foo = (1,2,3); my @bar = (4,5,6); @{$_[0]} = @foo; @{$_[1]} = @bar; }
or
getlists(\@a, \@b); print join(" ",@a),"\n",join(" ",@b); sub getlists { my ($foo, $bar) = @_; @$foo = (1,2,3); @$bar = (4,5,6); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Returning two lists from a sub
by MaxKlokan (Monk) on Jun 09, 2007 at 17:39 UTC |