Why should that last one return an empty list? I would expect an array of size 1 like the first 2 cases. Can someone please help shed some light on this? Thanks!use Data::Dumper; { # This Makes sense: my @b; my @a=$b[0]; print Dumper(\@a); # $VAR1 = [ undef ]; } { # So does this: my @a = []->[0]; print Dumper(\@a); # $VAR1 = [ undef ]; } { # But this makes no sense (and seems like bug): my @a = ()[0]; print Dumper(\@a); # $VAR1 = [] }
In reply to Array/List Strangeness by Manchego
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |