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()