in reply to Re: Re: multidimenional hashes
in thread multidimenional hashes

Maybe you'd better be sure that your keys are are not formatted numbers:

$fval{$flat[$i]+0}{$flong[$i]+0}

Replies are listed 'Best First'.
Re: Re: Re: Re: multidimenional hashes
by Anonymous Monk on Oct 11, 2002 at 14:13 UTC
    Yes! Thank you. (but, i still don't see what went wrong in my original example, since I "replicated" the string that was being stored in the variable, and yet still the hash value was undefined.)
      The compiler stores the numbers in your source code as numbers not as formated text. When you do something with it that requires a string it gets "stringified". Here is an example:
      $string = "39.750000"; $number = 39.750000; print "$string $number\n"; __OUTPUT__ 39.750000 39.75
      As you can see when the runtime stringifies $number it is not necessarily going to be in the same format as in the source code. So do your hash keys with either formatted text using sprintf or numbers by adding zero. I would probably use formatted strings, sometimes floating point numbers can be inconsistent due to their internal representation in hardware.

      --

      flounder