Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
There's more than one way to do things
 
PerlMonks  

Re^2: Optimization, side-effects and wrong code

by cbraga (Pilgrim)
on Sep 29, 2004 at 14:25 UTC ( [id://395095]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Optimization, side-effects and wrong code
in thread Optimization, side-effects and wrong code

Thanks for the tip. I guess it should be printed in bold in each's manpage.

ESC[78;89;13p ESC[110;121;13p

  • Comment on Re^2: Optimization, side-effects and wrong code

Replies are listed 'Best First'.
Re^3: Optimization, side-effects and wrong code
by BrowserUk (Patriarch) on Sep 29, 2004 at 15:08 UTC

    It is noted in the POD for keys:

    As a side effect, calling keys() resets the HASH's internal iterator, see each. (In particular, calling keys() in void context resets the iterator with no other overhead.)

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
      I had the misfortune of getting caught out by this the other day. I decided to call 'keys' inside a while (each) loop... this reset the pointer, causing an infinite loop :/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://395095]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.