|
|
| There's more than one way to do things | |
| PerlMonks |
Re: split string and always get last wordby GrandFather (Saint) |
| on Mar 01, 2006 at 21:11 UTC ( [id://533788]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
Note that the "magic" in the two answers that you have been given already is the [-1]. Index -1 gets you the last element in an array. -2 gets the penultimate element and so on. Also of interest is $#array which 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. DWIM is Perl's answer to Gödel
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||