foreach my $i( ['kept', 82], ['notkept', 1], ['repaired', 3] ) { ... # so $aref->[$i][0] # looks like $areg->[ ['kept', 82] ][0] # #### $ perl buggy_array.pl 2> out.txt (it hangs here, press Ctrl-C to stop) $ head -6 out.txt Use of reference "ARRAY(0x1cfb148)" as array index at ary.pl line 21. Use of uninitialized value in concatenation (.) or string at ary.pl line 21. Use of reference "ARRAY(0x1d0fad8)" as array index at ary.pl line 21. Use of uninitialized value in concatenation (.) or string at ary.pl line 21. Use of reference "ARRAY(0x1d0fbf8)" as array index at ary.pl line 21. Use of uninitialized value in concatenation (.) or string at ary.pl line 21. #### perl -E 'my $aref=[undef]; say 0 + $aref' 19468616 #### $areg->[ ['kept', 82] ][0] # becomes something like # $areg->[ 9999999 ][0] # (or whatever the memory address of that array is...) #### perl -E 'my $aref=[undef]; $aref->[1000][0]; say scalar @{ $aref }' 1001