in reply to array index -1 oddity

If you really do need something like that (I'd think about that first), you can write it briefly as $arr[@arr ? $#arr : 0] = $foo; or maybe (@arr ? $arr[-1] : $arr[0]) = $foo;

Makeshifts last the longest.