#!/usr/bin/perl use LWP::Simple; use strict; $|=1; my $url = "http://sulfericacid.perlmonk.org"; my $altavista = "http://www.altavista.com/web/results?q=link:$url&kl=XX&search=Search"; my $google = "http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=link%3A$url&btnG=Google+Search"; ######################## # Altavista! ######################## my $altavista_content = get("$altavista"); my @altavista_lines = split /\n/, $altavista_content; my $altavista_results; foreach my $altavista_line (@altavista_lines) { $altavista_results = $1 if $altavista_line =~ m/AltaVista found (.*) results/; } print "searched: $altavista\n"; print "results: $altavista_results\n"; ######################## # Google! ######################## my $google_content = get("$google", 'User-Agent' => 'Mozilla/4.76 [en] (win-98; U)'); my @google_lines = split /\n/, $google_content; my $google_results; my $hits; foreach my $google_line (@google_lines) { if ($google_line =~ /Results \d+<\/b> - \d+<\/b> of about ((\d{1,3}\,?)+)<\/b>/g) { $hits = $1; }} #Results 1 - 1 of 1. print "searched: $google\n"; print "results: $google_results $hits\n";