The stupid question is the question not asked | |
PerlMonks |
Re: Floats with trailing zeros as a hash keyby robartes (Priest) |
on May 09, 2003 at 15:05 UTC ( [id://256897]=note: print w/replies, xml ) | Need Help?? |
Hmm,
storing these with the prices as keys, as opposed to the more natural way of doing it the other way around, seems a bit funny to me. Do you perhaps want fast lookups of the prices? That said, there is no real need to store the two keys. Perl is smart enough to use the key in correct context. If you want to make sure the number gets printed with the trailing zero, use printf:
This way, there's no need to store two versions of the key. Let Perl convert to the correct context if needed, and use printf if you want to pretty print. CU
In Section
Seekers of Perl Wisdom
|
|