in reply to Parsing "&" from header.

That's ugly cargo-cult code. The following does your task nicely, if your perl isn't very outdated:

use strict; # might be a good idea, too. But the code: use CGI; my $q = CGI::->new; my %input = $q->Vars;

Replies are listed 'Best First'.
Re: Re: Parsing "&" from header.
by halley (Prior) on Mar 26, 2004 at 14:08 UTC
    And without any explanation, you just supplanted his cargo-cult for another cult.

    "Cargo cult" programming means "You have learned that if you do *this* random nonsense, you get the benefits."

    To break the cycle, the original poster must learn that there are no mysteries, that the actions are not random nonsense, and that they can get bigger benefits from understanding.

    Anonymous Monk, the suggestion to use the CGI module is a good one. Please read CGI as the barest of explanation of its capabilities. Many Perl books will suggest CGI over other approaches, too.

    Your original code only barely attempts to handle the parsing of $ENV{QUERY_STRING}, but there are a lot of ways this can go wrong if you're not careful. The CGI module is a predefined library which has been debugged over the past several years to handle all these problems in a consistent way.

    --
    [ e d @ h a l l e y . c c ]