in reply to Re: Getting arguments such as ?page=20 for web scripts
in thread Getting arguments such as ?page=20 for web scripts

The CGI module does many things. What is it that I am looking for?

- Monolith

  • Comment on Re: Re: Getting arguments such as ?page=20 for web scripts

Replies are listed 'Best First'.
Re(3): Getting arguments such as ?page=20 for web scripts
by dmmiller2k (Chaplain) on Jan 08, 2002 at 23:47 UTC

    CGI.pm has a method, param(), which when called with no arguments, returns a list of CGI parameters. When called with one of the parameters as an argument, param() returns its value. The following scriptlet gets its parameters and prints their values, in quotes.

    use CGI; my $q = new CGI; # so the output won't be interpreted as HTML print $q->header('text/plain'); print "$_ = '", $q->param($_), "'\n" for $q->params;

    Update: Oops! left out the second call to param()!

    dmm

    You can give a man a fish and feed him for a day ...
    Or, you can
    teach him to fish and feed him for a lifetime