Your solution is an excellent use of a HoH! Here are a few items to consider within your foreach:
foreach (@ARGV) { open my $fh, '<', $_ or die $!; while ( my $line = <$fh> ) { next unless my @p = $line =~ /^(chr.+?)\t+(\d+)\t+(\d+)/; $minmax{ $p[0] }{min} //= $p[1]; $minmax{ $p[0] }{max} //= $p[2]; if ( $p[1] < $minmax{ $p[0] }{min} ) { $minmax{ $p[0] }{min} = $p[1]; } if ( $p[2] > $minmax{ $p[0] }{max} ) { $minmax{ $p[0] }{max} = $p[2]; } } close $fh; }
Hope this is helpful.
In reply to Re^4: Find overlap
by Kenosis
in thread Find overlap
by linseyr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |