Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subroutine url's

Status
Not open for further replies.

perlone

Programmer
May 20, 2001
438
US
How do I create url's like these: playeropts.cgi?webmaster@lennyworld.com&jySGDn.g36bNs&lookself. I meant by the &lookself. I know you could do this with subroutine but i don't know how. I tried the following things but it's still not working.00

$query = $ENV{'QUERY_STRING'};

if ($query eq "Kombat") {
&kombat;
}

But it's still not working. Anyone knows how?
 
say this is the url:[tt]
script.pl?info&more+info&even+more+info
[/tt]
then, within your script, the envrionmental variable $ENV{QUERY_STRING} will be equal to everything after the '?' of the url, that is: "info&more+info&even+more+info"
now, i'm not sure what you want to do with this - it wasn't exactly clear from your question. you seem to want to look for a certain word in the query string and then execute a subroutine based on what that is. in that case, the operator 'eq' won't work, as it only matches if the two strings are EXACTLY the same. what you would want is a regex that looks for a certain pattern to be located anywhere in the string, something like:[tt]
$query = $ENV{QUERY_STRING};

if ($query =~ m/this+is+a+word$/)
{
&subroutine;
}[/tt]


possibly maybe? "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Thanks, I'll try to do that. The reason I'm doing is it's
a little much better and save some space on the disk. Like, for example, if the script is like: script.pl?&inv, script.pl should run this subroutine:

sub inv{
#text'
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top