Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: Stupid mistakes I repeatedly make

by runrig (Abbot)
on Mar 27, 2005 at 18:36 UTC ( #442675=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Stupid mistakes I repeatedly make
in thread Stupid mistakes I repeatedly make

Is it not rather that you can't easily tell from context whether foo is a hash or a hashref?
It's not paying attention to context. Last time I did that, I passed a reference to a named hash to a function, e.g., foo_function(\%hash), then in the function started using the argument as a hash instead of a hash reference, and inconsistently at that. And then going back to the calling function, and adding code that assumed the hash was a reference. TGFS (Thank Go(o?)d(ness)? for strict :)


Comment on Re^3: Stupid mistakes I repeatedly make
Download Code
Re^4: Stupid mistakes I repeatedly make
by tilly (Archbishop) on Mar 28, 2005 at 00:52 UTC
    I am religious about avoiding having a hash and a hashref in scope with the same name. That way lies insanity and (a couple of refactorings later) hard to track down bugs.
      Oh, I didn't actually have a hash and hashref in the same scope with the same name. Two functions, one with a hash, the other with a hashref, and me not paying attention to which was which. Nothing use strict couldn't find immediately.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2014-09-22 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (208 votes), past polls