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

Re: Difference of Hash

by Eily (Monsignor)
on Apr 06, 2017 at 10:12 UTC ( [id://1187239]=note: print w/replies, xml ) Need Help??


in reply to Difference of Hash

There are many cases where you use a variable that's not defined, out of scope, or not what you think ($key is not a hashref). Luckily you can find all those mistakes by applying three simple rules:

  • Add use strict; and use warnings; at the top of your file. Perl will now tell you about those mistakes.
  • Declare your variable with my. This way perl can tell when you've made a typo in a variable's name.
  • Avoid single letter names, especially $a, which has a special value (some built-ins may use and change it (like sort), and perl won't warn you if you forgot to declare it). $x and $y may be an exception because they are pretty explicit, but only when they are used as coordinates.

Replies are listed 'Best First'.
Re^2: Difference of Hash
by huck (Prior) on Apr 06, 2017 at 10:27 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2025-07-18 07:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.