Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Difference between for and foreach

by skaurus (Novice)
on Jun 13, 2013 at 18:40 UTC ( #1038822=note: print w/ replies, xml ) Need Help??


in reply to Re: Difference between for and foreach
in thread Difference between for and foreach

What about this bit then?

And it's faster because Perl executes a foreach statement more rapidly than it would the equivalent for loop.


Comment on Re^2: Difference between for and foreach
Download Code
Re^3: Difference between for and foreach
by runrig (Abbot) on Jun 13, 2013 at 19:47 UTC
    That comment is about the C-style for loops ( e.g. for ( $i = 0; $i < $j; $i++) versus iterating directly over a list ( e.g. for my $item (@array) ).
      Thanks! I expected a notification email, didn't received one and because of this I saw your answer just now.
Re^3: Difference between for and foreach
by choroba (Abbot) on Jun 13, 2013 at 20:11 UTC
    Regarding the context, I would say "the equivalen for loop" means the C-style loop. The documentation should probably be improved there.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Thanks!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2014-09-17 01:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls