in reply to Re^2: Is this a bug, or expected behavior?
in thread Is this a bug, or expected behavior?
No, you're dereferencing a single element of an array reference. Dereferencing a slice from an array reference would, though.
$ cat wa sub ctx { my $w = wantarray; if( defined $w ) { print $w ? "array\n" : "scalar\n"; } else { print "void\n" } 1; } my $a = [ qw( a b c ) ]; $a->[ ctx( ) ]; @{$a}[ ctx( ) ]; $ perl wa scalar array
|
---|