Although it's convenient that you can declare a whole lot of variables in one line, the big advantage is that you can handle assignments at the same time:
my ($foo, $bar) = @array;The only warning I can give is that using an undef in the list will throw warnings (errors?) in older versions of perl:
my (undef, $foo, undef, $bar) = @array;You can assign values from a list of scalars, as well, but I think it's less legible than assigning one at a time:
my ($foo, $bar, $baz) = (27, 'blah', $x);In reply to Re^2: my $x or my ($x)
by jhourcle
in thread my $x or my ($x)
by tamaguchi
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |