Samn has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
Re: Simple question - Passing variables in queary string
by dws (Chancellor) on Feb 01, 2002 at 06:25 UTC
    Your syntax is O.K. The problem is probably at the receiving end. Post the contents of file.cgi and we'll have a look at it.

    Do be forewarned that abuse might be heaped upon you if it's discovered that your script doesn't

    1. use CGI;
    2. use strict;
Re: Simple question - Passing variables in queary string
by grep (Monsignor) on Feb 01, 2002 at 06:26 UTC
    The answer to your problems is CGI.pm. This is standard with your perl distribution. You will only run into problems if you try to parse your query string. CGI.pm does this all (correctly) for you (and much more). IOW you are asking for a world of trouble if you avoid CGI.pm :)

    I would also recommend Ovid's excellent tutorial on CGI programming with perl

    Also to keep yourself in good standing at perlmonks I would recommend a couple of things.
  • read the literature on posting - turnstep's node is excellent at explaining many things a new monk should know.
  • always search before you post. I turned up many hits with query string. Pretty much saying the same that I am telling you.
  • Know thy FAQ

    grep
    grep> chown linux:users /world
(cLive ;-) Re: Simple question - Passing variables in query string
by cLive ;-) (Prior) on Feb 01, 2002 at 07:48 UTC
    If you're not using CGI.pm...

    Also, if you want to send non-word chars in the query string, remember to encode it first:

    $qs =~ s/ /+/g; $qs =~ s/(\W)/sprintf("%%%x", ord($1))/eg;
    cLive ;-)
Re: Simple question - Passing variables in queary string
by Parham (Friar) on Feb 01, 2002 at 11:08 UTC
    everything you send to your program in the query string will end up in $ENV{'QUERY_STRING'}. You can either parse that manually yourself, or as others have suggested, use CGI.pm which will do all the work for you :).