- 论坛徽章:
- 3
|
- #!/usr/bin/perl
- #
- open FH, "data" or die "open 'data': $!";
- while (<FH>) {
- chomp;
- if ($. == 1) {
- @col = (split)[0 .. 3, 5];
- next;
- }
- $i = $. - 2;
- ($col[0]->[$i], $col[1]->[$i], $col[2]->[$i], $col[3]->[$i], $col[4]->[$i]) = (split)[0 .. 3, 5];
- }
- print join("\t", @col), "\n";
- for (0 .. $i) {
- printf ("%s\t%s\t%s\t%s\t%s\t\n",
- $seconds[$_],
- $Primitive[$_],
- $Delta[$_],
- $Count[$_],
- $Type[$_],
- );
- }
- print "-" x 60, "\n";
- for $n (0 .. $i) {
- printf ("%s\t%s\t%s\t%s\t%s\t\n",
- $col[0]->[$n],
- $col[1]->[$n],
- $col[2]->[$n],
- $col[3]->[$n],
- $col[4]->[$n],
- );
- }
- close FH;
- __END__
- print "-" x 60, "\n";
- seek FH, 0, 0;
- while (<FH>) {
- print && next if $. == 1;
- chomp;
- $i = $. - 2;
- ($seconds[$i], $Primitive[$i], $Delta[$i], $Count[$i], $Type[$i]) = (split)[0 .. 3, 5];
- }
- for (0 .. $i) {
- printf ("%s\t%s\t%s\t%s\t%s\t\n",
- $seconds[$_],
- $Primitive[$_],
- $Delta[$_],
- $Count[$_],
- $Type[$_],
- );
- }
- close FH;
复制代码 |
|