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

[FWP] Q on Substitution improvement



I have this...

# ---------------------------------------------------------
# We are going to run through each name/value pair sent up and
# parse it to replace any RETURN (cr/lf) with <br>, the HTML line
# break code and quotes with '&quot;'.
for (keys %cgiNameValues)
{
   $cgiNameValues{$_} =~ s/\n/<br>/g;      # change RETURNS to <br>
   $cgiNameValues{$_} =~ s/\"/\&quot;/g;   # Change quotes to HTML code
}

OK, it works, but it doesn't feel right.

I also have a list of 50+ such swaps I need to make and I really don't think
I need to create 50 such lines.

Isn't there a Perl-ish method to run down my 50+ hash and do the swap?

Thanks

Walter


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