in reply to Re: better way to printing random hash key and its value
in thread better way to printing random hash key and its value
You could...
LINE: while(<IFH>) { chomp; my($nx,$ny) = split; next LINE if ($ny <= 1.0); CONDITION: foreach my $cond_ref ( @range_destination ) { my ( $min, $max, $dest ) = @$cond_ref; if ( $nx > $min && $nx < $max ) { $capVal_Hash{$dest}{$nx} = $ny; last CONDITION; } } }
One loop instead of two will save some time, I reckon.
If you know the frequency of values in your input, you can also order the @range_destination list so that the more frequent conditions are first, short circuiting the CONDITION loop faster.
|
|---|