in reply to Returning two lists from a sub
use warnings; use strict; my ($len, @temp) = getlists(); my @a = @temp[0..$len-1]; my @b = @temp[$len..@temp-1]; undef @temp; print "@a\n@b\n"; sub getlists { my @foo = (1,2,3); my @bar = (4,5,6); return scalar(@foo), @foo, @bar; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Returning two lists from a sub
by ikegami (Patriarch) on Jun 07, 2007 at 14:40 UTC |