in reply to Re: split string and always get last word
in thread split string and always get last word

... $#array ... gives the index number of the last element in @array. That is (generally) different than scalar @array which returns the number of elements in @array.

TWIMC: Of historical interest: The single circumstance in which $#array will not be different than scalar @array (i.e., @array evaluated in scalar context) is when the array base $[ is set to 1. This is no longer possible, and wasn't a good idea when it was possible.

See $[ in Deprecated and removed variables in perlvar for gory details.


Give a man a fish:  <%-{-{-{-<