Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by vroom (His Eminence)
on Jan 09, 2000 at 01:05 UTC ( #1893=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 find it in the special variable $#arrayname

For example:
@foo=('b','a','r'); $lastindex=$#foo; #in this case 2 the index of 'r'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2023-01-28 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?