At 21:32 28-10-01, you wrote:

>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?

Is this because you want to learn how to do this, or because you don't know
the easy way?

The easy way:

use CGI qw/:all escape/;

$formvar=param('formvarname') || 
redirect($ENV{'HTTP_REFERER}.'?missing=formvarname');


>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

In any case: I'm going for a free view of Lydia's buritos, here:

>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;

s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;

Yes, there is a difference:
[\dA-Fa-f][\dA-Fa-f]
[\dA-Fa-f] [\dA-Fa-f]

Whitespace is not ignorable in regexes - in fact you'll learn that it's the
most important piece.

>          $name =~ tr/+/ /;
>          $name =~ s/%([a-fA-F0-9] [a-fA-F0-9])/pack("C", hex($1))/eg;

same as above.

>          $searchField{ $name} = $value;
>       }
>     }
>   return (%searchField);
>}
>
>--------------------------------------------------------------------------------
>For unsubscription of this list send an email to [EMAIL PROTECTED] with 
>email
>data containing unsubscribe emailadd sambar

____________________________________________________

</MELVYN>

void wakeup()
{
         for(long int cuppajava;drink();cuppajava++);
}

--------------------------------------------------------------------------------
For unsubscription of this list send an email to [EMAIL PROTECTED] with email
data containing unsubscribe emailadd sambar

Reply via email to