Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Problem with hashes

by Ratazong (Monsignor)
on Feb 09, 2012 at 14:52 UTC ( [id://952743]=note: print w/replies, xml ) Need Help??


in reply to Problem with hashes

Hi!

The reason of this error-message is that there is no entry for $word[-1] in the hash. You could check with exists before to handle that situation.

HTH, Rata

PS.: please use <code>-tags!

Replies are listed 'Best First'.
Re^2: Problem with hashes
by rattytatty (Initiate) on Feb 09, 2012 at 15:06 UTC
    I've checked manually for a few of the keys in the hash
    file and the exist. I know for a fact that they all do
    exist as I used them to generate the hash in the first place.
      Rule one for debugging: checking is better than knowing for sure. So try copying the following code before your print and look what is happening ...:
      if (exists ($hash{$word[-1]})) { print("$word[-1] OK\n"); } else { print("$word[-1] isn't in the hash\n"); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-25 06:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found