- 论坛徽章:
- 5
|
{:2_177:}头好晕 @@
{:2_172:}小伙伴们, 测试测试?
# if [18656 18756] [18075 18656] is overlay
# USE:
# if ( $r2[$y][0] > $x->[1] ) {
# elsif ( $r2[$y][1] < $x->[0] ) { next }
# if [18656 18756] [18075 18656] is not overlay
# USE:
# if ( $r2[$y][0] >= $x->[1] ) {
# elsif ( $r2[$y][1] <= $x->[0] ) { next }- #!/usr/bin/perl
- open my $one, 'doc1';
- open my $two, 'doc2';
- my %doc1; map { @_ = split; push @{ $doc1{ shift @_ } }, [@_] } <$one>;
- my %doc2; map { @_ = split; push @{ $doc2{ shift @_ } }, [@_] } <$two>;
- while ( my ( $s, $r ) = each %doc1 ) {
- next unless $doc2{$s};
- my @r1 = @$r;
- my @r2 = @{ $doc2{$s} };
- my $i = 0;
- for my $x (@r1) {
- my $print = 1;
- for my $y ( $i .. $#r2 ) {
- if ( $r2[$y][0] >= $x->[1] ) {
- $i = $y;
- last;
- }
- elsif ( $r2[$y][1] <= $x->[0] ) { next }
- else { $print = 0 }
- }
- print join( "\t", $s, @$x ), "\n" if $print;
- }
- }
- __DATA__
复制代码 |
|