# you can get rid of the ($netHash{$val} > 1.0) test # I only included it to make the example more like yours if($netHash{$val} > 1.0 && $netHash{$val} < 1.4) { my ($x1, $y1) = ($val,$netHash{$val}); $capVal_1_Hash{$x1} = $y1; } elsif($netHash{$val} > 1.4 && $netHash{$val} < 1.9) { my ($x2, $y2) = ($val,$netHash{$val}); $capVal_2_Hash{$x2} = $y2; } ... ...