monkfish has asked for the wisdom of the Perl Monks concerning the following question:
I am ready to tear my hair out. I have been debugging for 5 hours now and I have found the bug in my morass of code, but I don't understand why it is occuring...
Here is a sample script that demonstrates the bug.
My element 00 in $hash doesn't print when I know it is there. I want to believe this is a perl bug, but I suspect it is really my not understanding how 00 is getting evaluated or something.
@foo = (0,1); $hash{00} = "data"; $hash{10} = "moredata"; print '$hash{00} is ', $hash{00} , "\n"; print '$hash{$foo[0] . "0"} is ', $hash{$foo[0] . "0"}, "\n"; print '$hash{$foo[1] . "0"} is ', $hash{$foo[1] . "0"}, "\n"; print '$hash{10} is ', $hash{10} , "\n";
The results are:
NOTE LINE 2 after is there is nothing!
$hash{00} is data $hash{$foo[0] . "0"} is $hash{$foo[1] . "0"} is moredata $hash{10} is moredata
What is going on?
-monkfish
The fishy monk.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Hash element that won't print. Perl Bug???
by snowcrash (Friar) on Oct 10, 2001 at 09:12 UTC | |
Re: Hash element that won't print. Perl Bug???
by nardo (Friar) on Oct 10, 2001 at 09:12 UTC | |
Re: Hash element that won't print. Perl Bug???
by mirod (Canon) on Oct 10, 2001 at 09:14 UTC | |
Re: Hash element that won't print. Perl Bug???
by kjherron (Pilgrim) on Oct 10, 2001 at 09:14 UTC | |
Re: Hash element that won't print. Perl Bug???
by cLive ;-) (Prior) on Oct 10, 2001 at 09:29 UTC |
Back to
Seekers of Perl Wisdom