Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 ( [id://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?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-07-16 09:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.