in reply to Not understanding 2 sentences in perldoc
List assignment:
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
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
|
---|
In Section
Seekers of Perl Wisdom