Whack three! I suddenly remember what it was like to learn Perl the
first time again. Boy do I feel confused. It's starting to work
though. Kinda like the first Perl CGI I wrote about seven years ago.
Probably just as ugly too. Anyone want to join in here, please feel
free!

#!/usr/bin/pugs

print "content-type: text/html\n\n";
my %q = ();
my @q = split '&', %ENV.{'QUERY_STRING'};

for (@q) {
        my ($n, $v) = split '=', $_;
        decode($n);
        decode($v);
        
        if (none(%q.{$n})) { %q.{$n} = [$v] }
        else { %q.{$n}.push($v) }
}

for (%q.keys) { say "$_ => "~%q.{$_}.join(', ')~'<br>' }

sub decode($input is rw) {
        $input ~~ s:Perl5:g/\+/ /;
        $input ~~ s:Perl5:g/%(..)/{chr(:16["0x$0"])}/;
}


--michael

PS Sorry, read the fine print. I'm not Columbian, it was just the
lowest valued denomination I could find. I reckon it comes to about
US$0.41 in total. But, to show what a stand-up guy I am, I will give
you that amount if we ever meet. I'm in London at the moment. Can you
make it?

Reply via email to