in reply to Re: Odd Hash behavior
in thread Odd Hash behavior

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

Replies are listed 'Best First'.
Re: Re: Re: Odd Hash behavior
by ysth (Canon) on Apr 15, 2004 at 00:13 UTC
    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);
Re: Re: Re: Odd Hash behavior
by Art_XIV (Hermit) on Apr 14, 2004 at 20:30 UTC

    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"
Re: Re: Re: Odd Hash behavior
by tedrek (Pilgrim) on Apr 14, 2004 at 20:27 UTC

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