CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
determine the current index in foreach-loop

 



yaniv_av
Novice

Oct 29, 2002, 9:31 PM

Post #1 of 2 (393 views)
determine the current index in foreach-loop Can't Post

How can I determine the current index (loop-counter) when using foreach-loop ?
Example:
foreach $word (@letter)
{...}

Now, I want to print the word number in the letter.
Can I do it without using another variable for counting ?
(Is There a internal-variable that contain the current index in the loop? )


thodi
stranger

Oct 30, 2002, 12:27 AM

Post #2 of 2 (390 views)
Re: [yaniv_av] determine the current index in foreach-loop [In reply to] Can't Post

No, I don't think there is an accessable special variable which does that. You can normally find out about special variables by reading perldoc perlvar.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives