jonnyfolk has asked for the wisdom of the Perl Monks concerning the following question:
The information currently picked up from the form is:read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; } else { $INPUT{$name} = $value; } }
I tried to get my checkboxes to function using:if ($INPUT{'onething'} eq "onething") { &onething; } elsif ($INPUT{'onething'} eq "twothing") {&twothing; } elsif ($INPUT{'threething'}) {threething; } else {&formula; } exit;
But alas $address remains undefined.if ($INPUT{'fourthing'} eq "four") { $address = "four.txt"; } elsif ($INPUT{'fourthing'} eq "five") { $address = "five.txt"; } elsif ($INPUT{'fourthing'} eq "six") { $address = "six.txt"; } else {&formula; }
I would be grateful if someone would point me in the right direction. (I could just rewrite it for CGI.pm but I would miss an opportunity of learning some more about environment vars - hence the question. :))
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting name value pairs from Environment Variables
by Roger (Parson) on Sep 26, 2003 at 00:26 UTC | |
by jonnyfolk (Vicar) on Sep 26, 2003 at 10:42 UTC | |
|
Re: Extracting name value pairs from Environment Variables
by sauoq (Abbot) on Sep 26, 2003 at 01:58 UTC | |
by jonnyfolk (Vicar) on Sep 26, 2003 at 10:48 UTC | |
|
Re: Extracting name value pairs from Environment Variables
by jonadab (Parson) on Sep 26, 2003 at 03:25 UTC |