in reply to What's happening in this expression?
> my $a, $x, $y, $z = foo()
The precedence of = is higher than , !
(my $a), ($x), ($y), ($z = foo())
That's effectively the same like 4 separate statements.
my $a ; $x ; $y ; $z = foo() ;
1. => scalar assignment to $z and scalar context for foo() call
2. => my declaration only for $a
3. => $x and $y are undeclared and in void context
4. => strict will fail
In short: DON'T!!!
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|Replies are listed 'Best First'.|
Re^2: What's happening in this expression? (Updated)
by likbez (Sexton) on Oct 12, 2020 at 00:24 UTC
by Fletch (Chancellor) on Oct 12, 2020 at 03:25 UTC
by likbez (Sexton) on Oct 15, 2020 at 04:08 UTC
by haukex (Bishop) on Oct 12, 2020 at 08:45 UTC
by AnomalousMonk (Bishop) on Oct 12, 2020 at 01:52 UTC