On Tue, Sep 28, 2010 at 07:07:38PM -0400, Greg London wrote: > Ive used $arr[-2] to get the second to last element of an array. > But anyone using $[ to change the first index of an array to be negative > should be beaten severely.
No, anyone using $[ at all should be beaten severely :-) Incidentally, $array[-1] (and -2, and ...) is Magic. It's not just because -1 is one less than the normal $[ that is gets treated specially, it's the fact that it's a negative number ... $ perl -le '$[=1;@array=qw(ant bat cat);print $array[1]' ant $ perl -le '$[=1;@array=qw(ant bat cat);print $array[0]' # WTF?!?! ant $ perl -le '$[=1;@array=qw(ant bat cat);print $array[-1]' cat Eeuuww -- David Cantrell | top google result for "topless karaoke murders" _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm