I've been caught on this before. You need brackets:- @{$arr[0]} = (4,3,2,1);
You are trying to access (or set in this example) the array within $arr[0]. Without the brackets Perl tries @{$arr}->[0] which is different.
Remember this in future situations, it could be much longer, such as:- %{$scalar_ref->[0]->{hashkey}->[5]}
Particularly if you are trying to do a foreach loop:- foreach my $key (keys %$scalar_ref->[0]->{hashkey}->[5]) {
Wont work, whereas:- foreach my $key (keys %{$scalar_ref->[0]->{hashkey}->[5]}) {
Will.
Hope that helps