(to the OP) - hash keys are always regarded as strings - that means you should make sure your numeric keys are represented as exactly the right string. I.e. $hash{1.0} is not the same as $hash{1}*. One way of doing that is to use sprintf. For example, if all your keys have 2 places behind the comma, you can use something like this:
Actually, it is. But $hash{"1.0"} is not the same as $hash{1.0} go figure. :-)my $key = sprintf("%0.2f",$number); my $value = $hash{$key}
In reply to Re^2: Numeric as hash key returns undef...
by Joost
in thread Numeric as hash key returns undef...
by journey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |