Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: How foreach loops decide what to iterate through

by ikegami (Patriarch)
on Feb 14, 2009 at 03:09 UTC ( [id://743757]=note: print w/replies, xml ) Need Help??


in reply to Re: How foreach loops decide what to iterate through
in thread How foreach loops decide what to iterate through

I would say that you should use the latter method, the one you prefer. It is more concise, easier to read, and a little more efficient.

1% and even 5% is within the margin or error of Benchmark, so that last phrase is inaccurate.

I'm actually surprised they're the same speed. @a = sort @a; is optimized to be done in place, and I think for (@a) is optimized over the more general for (LIST) (it's definitely implemented differently).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 02:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found