First off, I think you may have a typo. You're referencing a $col2_ variable (note the trailing underscore) that I don't think you meant to. I'm also guessing you wanted dollar signs in the right hand side too. Did you mean something like this?
$hash{$col1}{$col2 . '_' . $col3} = "$col4\t$col5"
Second, I don't know the context here, but it sounds like this sort of comparison and filtering would have been easier to do back before things had been put in the HoH.
On the assumption that this isn't an option, how about the following?
for my $c1 (keys %hash) { for my $c2_c3 (keys %{$hash{$c1}}) { my ($c2, $c3) = split('_', $c2_c3); if ( () # $c2 is ok && () # $c3 is ok ) { # do stuff for good data } else { # do stuff for bad data } } }
You'll have to fill in your range tests and actions to take for good/bad data.
In reply to Re: Search in Hash of Hash for the range of values
by perlpie
in thread Search in Hash of Hash for the range of values
by snape
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |