http://qs321.pair.com?node_id=185134
Category: PerlMonks Related Scripts
Author/Contact Info Graciliano M. P.
Description: Let's play with the PerlMonks site (code 0). This code get the page "Newest Nodes", see what users have posted, count the number of nodes, and show a list of user by activity.

#####################################
# PLAY WITH THE PERLMONKS SITE (0). #
#####################################

use LWP::Simple ;

$|=1;

my $numdays = 1 ;
my $url = "http://www.perlmonks.org/index.pl?node_id=3628&numdays=$num
+days" ;

print "Getting Newest Nodes...\n" ;
print "$url\n" ;

$html = get($url);
$html =~ s/\r\n?/\n/gs ;
$html =~ s/<.*?>//gs ;

my (@users) = ( $html =~ /by\s+(\w+)\s*\n/gsi );

my %users ;
foreach my $users_i ( @users ) { $users{$users_i}++ ;}

my $total_usr ;
my $nodes = @users ;

print "-----------------------------\n" ;
foreach my $Key ( sort {$users{$b} <=> $users{$a}} keys %users ) {
  my $Value = $users{$Key} ;
  print "$Key = $Value\n" ;
  $total_usr++ ;
}
print "-----------------------------\n" ;
print "Total users: $total_usr\n" ;
print "Nodes: $nodes\n" ;
# Send your feedback!
#
# "The creativity is the expression of the liberty".