Feed on
Posts
Comments

perl indexes from the back using negative numbers.  so to get the last element of @array:

$array[-1]


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

One Response to “last element of an array in perl”

  1. on 13 Jul 2011 at 2:11 pm Sanjay

    Thank you….it was very useful :)

    Cheers,
    Sanjay.

Did I get this wrong? Let me know!

Trackback URI | Comments RSS

More blogs about http://desk.stinkpot.org:8080/tricks.