#!/usr/local/bin/perl -w use strict; use URI; use LWP; foreach my $word (@ARGV) { next unless length $word; # sanity-check my ($content, $status, $is_success) = &do_GET($word); if (!$is_success) { print "Sorry, failed: $status\n"; } elsif ($content =~ /\sof\sabout\s([\d,]+)<\/b>/) { print "$word: $1 matches\n"; } else { print "$word: page not processable\n"; } sleep 2; #being nice to googles server } my $browser; sub do_GET { $browser = LWP::UserAgent->new() unless $browser; $browser->agent('Mozilla/5.0'); my $uri = URI->new('http://www.google.com/search'); $uri->query_form('q' => $_[0]); my $resp = $browser->simple_request (GET $uri); #THIS IS LINE 34 return ($resp->content, $resp->status_line, $resp->is_success, $resp) if wantarray; return unless $resp->is_success; return $resp->content; } #### TiB17:~/scripts/perl/lwp theloanarranger$ 2-6 friend Can't locate object method "GET" via package "URI::http" at /Users/theloanarranger/scripts/perl/lwp/2-6 line 34.