Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The input data looks like this$i=0; $j=0; while (<FIRE>) { chomp $_; ($fgid[$i], $fvalue, $flat[$i], $flong[$i]) = split /,/, $_; $fval{$flat[$i]}{$flong[$i]}=$fvalue; $i++; }
I'm trying to index fvalue with its latitude and longitude values. Something goes wrong though. For example, when I insertvirsfire_199801,-1,39.750000,-179.500000 virsfire_199801,-1,39.750000,-179.000000 virsfire_199801,-1,39.750000,-178.500000 virsfire_199801,-1,39.750000,-178.000000
I get the following output:print "testing: $flat[1], $flong[1]\n"; print "testing: $fval{39.750000}{-179.000000}\n"; print "testing: $fval{$flat[1]}{$flong[1]}\n";
It seems as if I'm not indexing on the numerical values, but rather on the variable names. Why is this? Thank you, oh monks.# ./join.pl testing: 39.750000, -179.000000 testing: testing: -1 [root@localhost newstore]#
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: multidimenional hashes
by fglock (Vicar) on Oct 11, 2002 at 12:46 UTC | |
by hmerrill (Friar) on Oct 11, 2002 at 13:45 UTC | |
by Anonymous Monk on Oct 11, 2002 at 12:59 UTC | |
by busunsl (Vicar) on Oct 11, 2002 at 13:03 UTC | |
by fglock (Vicar) on Oct 11, 2002 at 13:08 UTC | |
by Anonymous Monk on Oct 11, 2002 at 14:13 UTC | |
by flounder99 (Friar) on Oct 11, 2002 at 15:41 UTC |