[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Q on Substitution improvement



>>>>> "Roland" == Roland Giersig <roland.giersig@alcatel.at> writes:

Roland> Yes, there is:

Roland> %Subst = ("\n" => '<br>', 
Roland>           '"' => '&quot;',
Roland>           # etc...
Roland>          );

Roland> $SubstRE = join('|', keys %Subst);

You forgot to quote-meta the keys.

Roland> for (keys %cgiNameValues) {
Roland>   $cgiNameValues{$_} =~ s/($SubstRE)/$Subst{$1}/ego;
Roland> }

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org