链接标题 代码中的push @{ $R{$s[4]}{R}},[$s[1].$s[2]];这个{R}是什么意思?还有[$s[1].$s[2]]是一个两个元素的数组吗?
----------------------------------------------------------------------------------------
#!/usr/bin/perl
my %R;
while () {
my @s = split;
push @{ $R{ $s[4] }{R} }, [ $s[1], $s[2] ];
$R{ $s[4] }{ $s[1] } = [ @s[ 0, 3, 4, 5 ] ];
}
while ( my ( $k, $v ) = each %R ) {
my @tmp = sort { $a->[0] <=> $b->[0] } @{ $v->{R} };
my ( $E, @R ) = ( 1, shift @tmp );
for my $t (@tmp) {
$t->[0] > $R[-1][1] && push @R, $t and next;
$t->[1] > $R[-1][1] && ( $R[-1][1] = $t->[1] )
}
for my $R (@R) {
my ( $A, $B, $C, $D ) = @{ $v->{ $R->[0] } };
print join( "\t", $A, @$R, $B, "${C}_E" . $E++, $D ) . $/;
}
}
-------------------------------------------------------------------------------