Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- my %cumCount;
- my $totalCount;
- for (my $cnt=1;$cnt<=30;$cnt++) {
- open(IN, "Downloads/$cnt.aspx") or die "Can't read $cnt.aspx\n";
- print STDERR "Reading Downloads/$cnt.aspx\n";
- my $foundPosts=0;
- while(<IN>) {
- chomp;
- if ($_ =~ /--- Posts ---/) {
- $foundPosts=1;
- print "HI: $_\n";
- while($_ !~ /--- Replies ---/) {
- $_=<IN>;
- chomp;
- print "NOW THIS:$_\n";
- next if (/Show official posts/);
- if (!/^\s*<option value="\S+">(\S+)\s*\((\d+)\)<\/option>\s*$/) {
- print STDERR "WARNING: $_\n";
- die "Unexpected syntax on $cnt.aspx line $.\n$_\n" if ($_!~/--- Replies ---/);
- }
- else {
- my $poster=$1;
- my $count=$2;
- print "$count votes from $poster\n";
- $cumCount{$poster}+=$count;
- $totalCount+=$count;
- }
- }
- close(IN);
- print "NOW GOT: $_\n";
- }
- }
- close(IN);
- die "Error: didn't find post listings in $cnt.aspx\n" if (!$foundPosts);
- }
- print "Total posts: $totalCount\n";
- foreach my $person (sort {$cumCount{$b} <=> $cumCount{$a}} keys %cumCount) {
- print "$person $cumCount{$person}\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement