http://www.perlmonks.org?node_id=541137


in reply to Re: my $x or my ($x)
in thread my $x or my ($x)

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