Created
March 3, 2010 05:12
-
-
Save jhannah/320348 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| use diagnostics; | |
| my %weeks; | |
| open my $fh, "<", "weekConverter.txt" or die "Can't open weeks file: $!"; | |
| while (<$fh>) { | |
| chomp; | |
| my ($date, $week) = split /\t/; | |
| } | |
| close $fh; | |
| my $stats = {}; | |
| open my $fh, "<", "NAdate_type.txt" or die "Can't open types file: $!"; | |
| <$fh>; # discard header | |
| while (<$fh>) { | |
| chomp; | |
| my ($type, $date) = split /\t/; | |
| my $week = $weeks{$date}; | |
| my $stats->{$week}->{$type}++; | |
| } | |
| close $fh; | |
| foreach my $week (keys %stats) { | |
| foreach my $type (keys %{$stats->{$week}}) { | |
| print "$week $type " . $stats->{$week}->{$type} . "\n"; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment