> "If more than one variable is listed, the list must be placed in parentheses"
means:
If VARLIST is
$x,$y,$z
you must write
my ($x,$y,$z)
The alternative
my $x,$y,$z
would only declare $x because of precedence, like
(my $x),$y,$z
Hence an alternative to what we want is
my $x,my $y,my $z
But since we need a list assignment on the LHS, we still need to put it all into parens
(my $x,my $y,my $z) = split ...
because this
my $x,my $y,my $z = split ...
would only assign to $z because of precedence°, like
(my $x),(my $y),(my $z = split ...)
HTH! :)
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
s/declare/assign to/ choroba++
°) Even worse, it would only be a scalar assignment to $z, i.e. the number of possible splits.
In reply to Re^3: my within brackets
by LanX
in thread my within brackets
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |