Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: getting iteration number inside iteration loop

by GrandFather (Saint)
on Jun 29, 2007 at 07:34 UTC ( [id://624054]=note: print w/replies, xml ) Need Help??


in reply to getting iteration number inside iteration loop

There is not. BTW, if you:

my $iteration_number = 0; foreach my $val ( @array ) { $iteration_number ++; print ":$iteration_number:\n"; }

then you know how may times the loop was entered by inspecting $iteration_number after the loop has completed.


DWIM is Perl's answer to Gödel

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found