Up front, given a url such as
http://www.somedomain.com/cgi-bin/cgi.pl/more/path.html?more=info&here=1
and assuming that /cgi-bin/cgi.pl is the cgi being run you would get the following information:
$ENV{HTTP_HOST} = 'www.somedomain.com';
$ENV{SCRIPT_NAME} = '/cgi-bin/cgi.pl';
$ENV{PATH_INFO} = '/more/path.html';
$ENV{QUERY_STRING} = 'more=info&here=1';
$ENV{REQUEST_URI} = '/cgi-bin/cgi.pl/more/path.html?more=info&here=1';
When in doubt, do a Data::Dumper::Dumper(\%ENV) and you will be able to see all of the information in %ENV.
my @a=qw(random brilliant braindead); print $a[rand(@a)];