in reply to Value in the range struggling (once more)
Perhaps this will help:
#!/usr/bin/perl use warnings; use strict; use Inline::Files; my %ranges; while ( <RANGE> ) { next unless /\S/; my ( $key, $start, $end ) = split; push @{ $ranges{ $key } }, [ $start, $end ]; } while ( <CODE> ) { next unless /\S/; my ( $key, $code ) = split; if ( exists $ranges{ $key } && grep $code >= $_->[ 0 ] && $code <= + $_->[ 1 ], @{ $ranges{ $key } } ) { print; } } __RANGE__ T2 23 43 T2 45 78 Tn 66 124 __CODE__ T2 34 lit T3 20 mir Tn 100 net2 Tk 1234 low3
Produces the result:
T2 34 lit Tn 100 net2
|
|---|