in reply to Re: not able to get last index of array
in thread not able to get last index of array

Quite. It's even simpler if you know that List::Util has been in core for the last decade and has its own max() function.