Sean M Burke has a nice little program in his book Perl & LWP which uses AltaVista to check the popularity of words, which I modified slightly to use Google instead. Here it is:
#!/usr/bin/perl use warnings; use strict; # goolies: check popularity of words on Google. modified from: # Example code from Chapter 2 of /Perl and LWP/ by Sean M. Burke # http://www.oreilly.com/catalog/perllwp/ # sburke@cpan.org use LWP; use URI::Escape; die "Usage: goolies word1 word2\n" unless @ARGV; foreach my $word (@ARGV) { next unless length $word; my $url = 'http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q= +' . uri_escape($word) . '&btnG=Google+Search'; my ($content, $status, $is_success) = do_GET($url); if (!$is_success) { print "Sorry, failed: $status\n"; } elsif ($content =~ m#of about <b>(\d+,?\d*,?\d*)</b>#) { print "$word: $1 matches\n"; } else { print "$word: couldn't extract count due to some weird shit at + $url\n"; } sleep 2; # be nice to Google's servers!!! } ##### subs ##### sub do_GET { my $browser = LWP::UserAgent->new(); $browser->agent('Mozilla/4.76 [en] (Win98; U)'); # tricked you! my $response = $browser->get(@_); return ($response->content, $response->status_line, $response->is_ +success, $response) if wantarray; return unless $response->is_success; return $response->content; }

In reply to check words' popularity using Google by mooseboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.