this
> "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! :)
Errata
s/declare/assign to/ choroba++
UPDATES
°) Even worse, it would only be a scalar assignment to $z, i.e. the number of possible splits.
| [reply] [d/l] [select] |