Seconded on the using floats as hash keys being a bad idea. Run this version to see why:
my @keys = qw( 0 0.1 0.3 1 3 10 30 1000 ); my %n; for ( my $mag = 5.0 ; $mag < 9.0 ; $mag += 0.1 ) { @{ $n{ $mag } }{ @keys } = ( 0 ) x @keys; } for ( sort { $a <=> $b } keys %n ) { print "mag: $_\t$n{$_}->{30}\n"; }
Perhaps if you step back and described what you're trying to accomplish with this hash . . .
In reply to Re: Problems with defining hashes
by Fletch
in thread Problems with defining hashes
by Annemarie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |