Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 ( [id://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?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-07-19 11:11 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.