#!/usr/bin/perl -w use strict; my %pageRankURLs = ('http://persistent.info/' => '61576108155', 'http://www.mscape.com/' => '6155344674', 'http://www.google.com/' => '64222138902'); my $kRequestURLTemplate = 'http://www.google.com/search?client=navclient-auto&ch=%s&features=Rank&q=info:%s'; print < PageRank™ Monitor http://www.google.com/ 30 HEADER foreach my $pageRankURL (keys %pageRankURLs) { my $pageRankRequestURL = sprintf($kRequestURLTemplate, $pageRankURLs{$pageRankURL}, $pageRankURL); open(CURL, "curl -s \"$pageRankRequestURL\"|") or die("can't launch curl"); my $pageRank = 'Not found'; while () { chomp; $pageRank = $1 if (/Rank_1:\d+:(\d+)/); # the first set of numbers is how many digits there are in the pagerank } close(CURL); print "$pageRankURL: $pageRank\n"; } print < FOOTER