in reply to Passing Arguments With Perl/Cgi

(It's very important to know how to do it yourself.)

Here's my way to do it. Note how it catches invalid pairs.

if ($ENV{'REQUEST_METHOD'} eq "GET") { for (split(/\&/, $ENV{'QUERY_STRING'}) { if (($name, $value) = /(.*)=(.*)/) { ## Normal $value =~ ## Unescape $value here } else { ## Abnormal, no "equal"! $name =$_; $value=0; } $name =~ ## unescape $name here }

Update:Yes, I know, you should just use CGI. The above code is merely for educational purposes, please use CGI for any "real" code. :)

Replies are listed 'Best First'.
Re^2: Passing Arguments With Perl/Cgi
by Anonymous Monk on Feb 19, 2009 at 15:19 UTC
    Presuming your code isn't on a home personal enviroment in a lot of cases it simply isn't practical to use modules. In the case of code used on a 1000 machines say.

      If you have 1000 machines at your disposal, you also have a mechanism for file distribution among them. So that's a non issue. Yes, even you can use CPAN.