Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How do I find the index of the last element in an array?

by chromatic (Archbishop)
on Jan 23, 2000 at 05:44 UTC ( #2359=note: print w/replies, xml ) Need Help??


in reply to How do I find the index of the last element in an array?

You can also use negative array indexes:
my @demo = ("one", "two", "three", "four"); print $demo[-1];
The result is "four".

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://2359]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2023-02-07 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (39 votes). Check out past polls.

    Notices?