$ perl -MData::Dumper -le'@a=qw/a b c/; @foobar = map { $_ } @a[0..7]; print Dumper \@a' $VAR1 = [ 'a', 'b', 'c', undef, undef, undef, undef, undef ];
Fairly obviously, I have created a list with 3 elements in it, tried to slice it with 8 values and assign that to a different list, however when printing the contents of the original list, it has now been padded out to 8 values with undefs. Ok, I thought perhaps doing a slice on a list had that kind of destructive behavior but I had just never noticed it before and had never heard about it previously. So I tried another one-liner to perhaps prove that theory:
$ perl -MData::Dumper -le'@a=qw/a b c/; @foobar = @a[0..7]; print Dumper \@a' $VAR1 = [ 'a', 'b', 'c' ];
Nope. Bug? Or expected behavior for some reason that I cannot figure out? This was on Perl 5.8.9