PDA

View Full Version : Very Simple Perl Question



Canuckkev
March 4th, 2001, 12:03
I have very little perl scripting abilities, and I was wondering how you retrieve variables from the query string. Like, if I send someone to http://mysite.com/script.cgi?name=blah&email=something

How do I retrieve those variables in my script?
$name wouldn't be "blah", would it? Please help, thanks.

Canuckkev
March 4th, 2001, 13:55
Never mind, I figured it out. If you also would like to know:



use CGI;
$cgi = new CGI;
$nameofperson = $cgi->param("name");
$emailaddress = $cgi->param("email");


How it works is if you have a string http://something.com?name=Bob&email=bob@bob.com , then it will store "Bob" as $nameofperson, and "bob@bob.com" as $emailaddress. I'm sure anyone whose ever done Perl scripting knew this, but for those who don't I think it can be useful.