#!/usr/bin/perl # James Stanley 2011 # Count the number of IRC posts at different times of day my %posts = (); while(<>) { my $time = substr($_, 12, 8); if($time !~ /(\d\d):(\d\d):(\d\d)/) { next; } $hours = $1; $minutes = $2 + $hours * 60; $key = $minutes; if(exists $posts{$key}) { $posts{$key}++; } else { $posts{$key} = 1; } } while(($time, $count) = each(%posts)) { print "$time $count\n"; }