I'm entering this code as written in a book, but can't get it to work. The
splits work, the translate works but the substitute does not.......... The
data returned keeps the special characters IE %27. I have experimented
using the /d (for decimal) and entering 0-9 for matches but neither works.
WHAT AM I MISSING?
returned data =
Lydia%27s burritos are the greatest%21 The guys at work loved them and it
was a real treat when she would prepare them for a team
lunch.%0D%0A%0D%0A%0D%0A%0D%0AJim
sub readPostInput(){
my (%searchField, $buffer, $pair, @pairs);
if ($ENV{ 'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{ 'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs){
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s /%([\dA-Fa-f] [\dA-Fa-f])/pack ("C", hex ($1))/eg;
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg;
$searchField{ $name} = $value;
}
}
return (%searchField);
}
--------------------------------------------------------------------------------
For unsubscription of this list send an email to [EMAIL PROTECTED] with email
data containing unsubscribe emailadd sambar