> You cannot return multiple lists from a function in Perl
well the OP is trying to return multiple array-refs not lists, and the new'ish use feature qw/refaliasing/; allows these to be assigned to multiple @arrays. (see tst2())
use strict; use warnings; use Data::Dump qw/pp dd/; use feature qw/refaliasing/; no warnings "experimental::refaliasing"; sub tst { (\my %args) = @_; pp \%args; } tst({a=>1,b=>2}); sub tst2 { return [1..3],[4..7] } our (@a,@b); (\@a,\@b) = tst2(); pp \@b; pp \@a;
{ a => 1, b => 2 } [4 .. 7] [1, 2, 3]
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
In reply to Re^2: Returning arrays from a package (feature qw/refaliasing/;)
by LanX
in thread Returning arrays from a package
by sherab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |