Untitled

Submitted by reeses on Sat, 2003-08-23 17:22.

#!/usr/bin/perl


my $url = "http://www.google.com/search?q=";

foreach $arg (@ARGV) {
if ( $arg eq "+" ) {
$url = "$url+%2B";
} else {
$url = "$url+$arg";
}
}

my $cmd = qq{lynx -dump -accept_all_cookies "$url" | grep calc_img.gif | sed "s/.*= //"};

my $result = `$cmd`;

print $result . " ";

People mock my perl-fu. I don't know why.


$ ./calc.pl feet in a mile
5 280 feet

$ ./calc.pl avogadros number
6.02214199 � 10^23

$ ./calc.pl feet in avogadros number miles
3.17969097 � 10^27 feet

Post new comment

Captcha Image: you will need to recognize the text in it.
Please type in the letters/numbers that are shown in the image above.