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

Re^4: Why does this sub grab the whole hash

by naturalsciences (Beadle)
on Nov 11, 2011 at 18:29 UTC ( [id://937649]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Why does this sub grab the whole hash
in thread Why does this sub grab the whole hash

Oh man - enlightenment just hit me. Looked over my code and now I got how this poor array was filled over and over again with some quite random stuff in the different parts of my script. Really bad idea to use a subs like this with a globally defined array.

  • Comment on Re^4: Why does this sub grab the whole hash

Replies are listed 'Best First'.
Re^5: Why does this sub grab the whole hash
by moritz (Cardinal) on Nov 11, 2011 at 18:32 UTC

    And that's why people always recommend to usestrict; -- it complains about undeclared variables, so it forces you to think about where to put the declaration. And you only put the declaration outside the subroutine if that's your conscious choice.

Re^5: Why does this sub grab the whole hash
by AnomalousMonk (Archbishop) on Nov 11, 2011 at 20:39 UTC
    Really bad idea to use a subs like this with a globally defined array.

    It's a really bad idea to use subs (or anything else) with a globally defined, non-constant anything unless, as moritz has written, it's your conscious decision to do so — and even then I'd think twice about it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-18 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found