- 论坛徽章:
- 0
|
output- A 375904 375906
- A 375908 375912
- B 29172057 29172063
- B 29172065 29172066
复制代码 data structure @Z- [
- [ A, [ 375904, 375906 ], [ 375908, 375912 ], [ 375917 ], [ 375919 ] ],
- [ B, [ 29172057, 29172063 ], [ 29172065, 29172066 ] ]
- ]
复制代码 code
- use 5.010;
- my ( $X, $Y, @Z ) = '';
- while (<DATA>) {
- my ( $x, $y, $z ) = split;
- next if $z <= 5;
- $X ne $x
- ? push @Z, [ $X = $x, [$y] ]
- : $y - $Y == 1
- ? ( $Z[-1][-1][1] = $y )
- : push @{ $Z[-1] }, [$y];
- $Y = $y;
- }
- for (@Z) {
- my ( $x, @y ) = @$_;
- @$_ > 1 and say join "\t", $x, @$_ for @y;
- }
- __DATA__
- A 74851 1
- A 74852 1
- A 375904 6
- A 375905 6
- A 375906 7
- A 375908 7
- A 375909 7
- A 375910 7
- A 375911 7
- A 375912 7
- A 375917 7
- A 375919 7
- B 29172057 19
- B 29172058 19
- B 29172059 19
- B 29172060 19
- B 29172061 19
- B 29172062 19
- B 29172063 19
- B 29172065 19
- B 29172066 19
- B 29216088 1
- B 29216089 1
复制代码 |
评分
-
查看全部评分
|