#!/usr/bin/perl use strict; use warnings; use HTML::TableContentParser; use WWW::Mechanize; use constant DATE => 3; use constant STATS => 4; my %opt = ( url => 'http://tinymicros.com/pm/index.php?goto=monkstats&sortopt=13&sortlist=1,3&', end => 500, pos => 0, ); my $mech = WWW::Mechanize->new( autocheck => 1 ); my %date; while ( $opt{pos} <= $opt{end} ) { $mech->get( $opt{url} . '&start=' . $opt{pos} ); my $table = HTML::TableContentParser->new()->parse( $mech->content() ); for my $row ( @{ $table->[ STATS ]{rows} } ) { my $stamp = ${ $row->{cells} }[ DATE ]{data}; next if ! $stamp; ($stamp) = $stamp =~ m|(.*)|; $date{ substr($stamp, 0, 10) }++; } $opt{pos} += 50; select(undef, undef, undef, 0.75); } print "$_,$date{$_}\n" for sort keys %date;