On Mon, May 14, 2012 at 2:51 PM, David Cantrell <[email protected]> wrote:
For extra excitement, perl has this nifty feature where you can index from the end of an array using negative numbers:@array = ('ant', 'bat', 'camel', 'dolphin'); print $array[-1]; # dolphin print $array[-2]; # camel I leave it as an exercise for the reader to figure out what the hell should happen if $[ is set to -2.
Or 1 (or 7), for that matter. (I believe the answer is documented, but it's not as immediately obvious without some mental arithmetic.) Cheers, Philip -- Philip Newton <[email protected]>
