in reply to Command Line Google, AskJeeves, Dictionary, and Thesaurus

Thanks much, all! I've used your suggestions to make the code to be shorter, more portable, and more robust:

#!/usr/bin/perl use warnings; use strict; use Getopt::Long; use URI::Escape; { my %pars = DoGetOptions () if scalar @ARGV; my $str = "$pars{browser} $pars{site}" . uri_escape ( join '+', @AR +GV ); die "$str\n" if $pars{norun}; system $str; } sub DoGetOptions { my @sitelist = qw{ http://www.google.com/search?q= http://dictionary.reference.com/search?q= http://www.ask.com/main/askjeeves.asp?ask= http://thesaurus.reference.com/search?q= + }; my %pars = ( picksite => 0, site => '', browser => 'lynx -cookies A', #netcape #firefox norun => 0, ); GetOptions ( \%pars, qw{ picksite=s site=s browser=s norun } ) or die "bad options $!"; $pars{site} = $sitelist[$pars{picksite}] if '' eq $pars{site}; return %pars; }