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

Re: Odd Hash behavior

by tedrek (Pilgrim)
on Apr 14, 2004 at 20:18 UTC ( #345192=note: print w/replies, xml ) Need Help??

in reply to Odd Hash behavior

Have you checked that $partnum contains what you expect it to?

Replies are listed 'Best First'.
Re: Re: Odd Hash behavior
by SpritusMaximus (Sexton) on Apr 14, 2004 at 20:20 UTC
    Yes. I verified, using print statements, that the partnumber is the same both when I add it to the hash and when I look for the existence of the hash. Also, when I print out the keys, the part number is there in all its glory.

    If it helps, I'm using cygwin and perl 5.8.0.

    Also, I verified that there is no CR/LF (I'm presuming this is why people are suggesting chomp()).
      Rather than using simple print statements, do:
      use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Useqq = 1; ... print "partnum: ", Dumper($partnum), "\nkeys:\n", Dumper(keys %part_fi +le);

      Does the part number key contain leading/trailing gunk?

      Data::Dumper and/or placing leading and trailing sigils in your print statements can help detect unexpected whitespace.

      Hanlon's Razor - "Never attribute to malice that which can be adequately explained by stupidity"

      It sounds like $partnum is not the same, perhaps the case is different? It would help if we had a sample to look at as the code you've given doesn't seem to have any errors.

      Yes the possible presence of a CR/LF is why ppl are suggesting chomp()

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2021-09-22 20:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found