This behavior appears somewhere between versions 5.12.3 and 5.14.4, but a quick scan of the deltas (update: between these versions) shows no justification for it. (Update: All code run under Windows 7.)
Version 5.14 is the latest I can access ATM.c:\@Work\Perl\monks>perl -wMstrict -le "print 'perl version: ', $]; ;; use Data::Dumper; ;; @_ = qw( a b c ); print( ( shift @_ )[ 0, 0, 0 ] ); ;; @_ = qw( a b c ); my @A = ( shift @_ )[ 0, 0, 0 ]; print Dumper \@A; ;; @A = ( 'x', 'y', 'z' )[ 0, 0, 0 ]; print Dumper \@A; " perl version: 5.012003 aaa $VAR1 = [ 'a', 'a', 'a' ]; $VAR1 = [ 'x', 'x', 'x' ]; perl version: 5.014004 aaa $VAR1 = [ 'a', undef, undef ]; $VAR1 = [ 'x', 'x', 'x' ];
Give a man a fish: <%-{-{-{-<
In reply to Re^4: Case where '( shift @_ )[ 0, 0 ]' returns only one value?
by AnomalousMonk
in thread Case where '( shift @_ )[ 0, 0 ]' returns only one value?
by rsFalse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |