in reply to Re: Getting first and last element value of a hash loop
in thread Getting first and last element value of a hash loop

Or, simply use -1 to get the last element: $array[-1]. See perldata: Subscripts.