Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open FH, "results.tsv";
- @lines = <FH>;
- close FH;
- for $line (@lines) {
- @info = split/\t/, $line;
- $ids{$info[7]} = $info[6];
- if ($info[0] =~ /(\d\d\d\d)$/) {
- $year = $1;
- if ($last{$info[7]} ne $info[0]) {
- $all{$info[7]}++;
- $comps{$year}{$info[7]}++;
- $last{$info[7]} = $info[0];
- }
- }
- }
- open FH, ">output.txt";
- print FH "\n\nAll\n\n";
- %y = %all;
- &prtsorted;
- for $year (reverse(2003..2010)) {
- print FH "\n\n".$year."\n\n";
- %y = %{$comps{$year}};
- &prtsorted;
- }
- close FH;
- sub prtsorted {
- $i = 1;
- $nu = 0;
- $pre = 0;
- foreach $id (sort {$y{$b} <=> $y{$a}} keys %y) {
- if ($i <= 500 || $pre == $y{$id}) {
- if ($pre == $y{$id}) {
- $nu++;
- } else {
- $nu = 0;
- }
- print FH $i-$nu.". ".$ids{$id}." ".$y{$id}."\n";
- $pre = $y{$id};
- $i++;
- } else {
- last;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement