Uri,
 
thx. I like that suggestion, i totally missed that earlier. I will explore cgi 
module.
 
 

From: Uri Guttman <u...@stemsystems.com>
To: Rajeev Prasad <rp.ne...@yahoo.com>
Cc: Perl Beginners <beginners@perl.org>
Sent: Tuesday, September 6, 2011 7:24 PM
Subject: Re: form POST string parser

>>>>> "RP" == Rajeev Prasad <rp.ne...@yahoo.com> writes:

  RP> hi,
  RP>  
  RP> which of the two is better? thx.
  RP>  
  RP> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  RP>  
  RP> or
  RP> $value =~ s/%(..)/chr(hex($1))/ge;

both are bad because parsing your own http data is a bad thing. it has
little gotchas all over. use one of the several modules (CGI.pm and
others) that do this for you. they do it correctly and cover all the
little corner cases.

uri

-- 
Uri Guttman  --  uri AT perlhunter DOT com  ---  http://www.perlhunter.com --
------------  Perl Developer Recruiting and Placement Services  -------------
-----  Perl Code Review, Architecture, Development, Training, Support -------

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/

Reply via email to