http://qs1969.pair.com?node_id=786022


in reply to Re^3: Array/List Strangeness
in thread Array/List Strangeness

There is no such thing as a non-existing array element. Every element of an array, which has not been set to something else, will return the value undef. Even if you only use the first 10 elements of the array, all other elements are virtually existing and hold the value undef. Also, an array is evaluated as a list in list context, but this happens after the slicing. Compare the results of the following code:
use Data::Dumper; my @foo = qw/a b c/; my @bar = $foo[3]; print Dumper \@bar; @bar = ( @foo )[3]; print Dumper \@bar;