#!/usr/bin/perl
use LWP::UserAgent;
$word = $ARGV[0];
$ua = LWP::UserAgent->new;
$req = HTTP::Request->new(GET => "http://www.googlism.com/index.htm?ism=$word&type=1");
@data = split(/\n/, $ua->request($req)->as_string);
foreach $line (@data) {
if($line =~ /^.*?($word\s+is\s+.*?)\
/i) {
push(@q,$1);
}
}
$s=@q;
print "Out of $s possibilities, we've chosen......\n";
print "$q[(int rand($s))]\n";
Monday, April 28, 2008
Perl googlism
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment