#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $start=5000; my $ua = LWP::UserAgent->new(); my $out; my %monkdays; if ($ARGV[0] eq "readfile"){readfile()} open ($out,">>","monkdays.txt") or die "Can't open file because $!"; while ($start < 10000) { my $req = HTTP::Request->new(GET=>"http://tinymicros.com/pm/index.php?goto=monkstats&sortopt=7&sortlist=10%2C1%2C3&start=$start&"); my $result = $ua->request($req); my $content; if ($result->is_success){$content= $result->content} else {last} for (split/<\/TR>/,$content) { my (@fields)= $_=~ /(.*?)<\/NOBR>/g; my $nick; my $first; if ($fields[2] =~ /HREF/ && ($fields[3]=~/^[2005|2006]/)) { ($nick) = $fields[2]=~/blank">(.*?)<\/A>/; ($first) = $fields[3]=~/(\d+\-\d+\s+)/; } else { next } # push @{$monkdays{$first}},$nick; print $out "$nick - $first\n"; } print $out "$start\n"; $start +=50; sleep 15; } sub readfile { my $in; open ($in,"<","monkdays.txt") or die "Shan't! $!"; while (<$in>) { if ($_ =~/^\d+$/){next} my ($nick,$first) = split / - /,$_; push @{$monkdays{$first}},$nick; } for (sort keys %monkdays) { print $_."\n"; for (@{$monkdays{$_}}) { print $_."\n"; } print "\n"; } exit; }