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; }