Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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.

Replies are listed 'Best First'.
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 (Chancellor) 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.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1038822]
[Corion]: marto: Great! The German Perl Workshop was a success even though things looked dire before, and I'm now back at home with two days off work still to go ;)
[Corion]: I hope things have settled down a bit for you and the boys are alright?!
[choroba]: Good morning, if a bit rainy
[marto]: life is a struggle :P I'm glad the GPW went well.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2017-06-29 08:07 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (655 votes). Check out past polls.