in reply to Not understanding 2 sentences in perldoc
my ($x, $y, $z) = qw( 1 2 3 );
List assignment in list context produces a list of lvalues:
(my ($x, $y, $z) = qw( 1 2 3 )) = qw( a b c ); # $x = 'a', $y = 'b', $ +z = 'c'.
List assignment in scalar context:
print scalar (my ($x, $y, $z) = qw( a b c d )); # 4
Modifying a scalar assignment:
($x = 12) =~ s/1/4/; print $x; # 42
|
|---|