in reply to preserving html in patterns
This does not encode newlines and carriage returns, only spaces. Why you would want to use or i don't know, but you can use this to achieve that without encoding spaces:use strict; my $line = '$x += 2; $y = $x**2'; $line =~ s/([^\sa-zA-Z0-9])/'&#'.ord($1).';'/ge; # or if you don't want to encode underscores $line =~ s/([^\s\w])/'&#'.ord($1).';'/ge; print "$line\n";
s/([^ a-zA-Z0-9])/'&#'.ord($1).';'/ge # a single, literal space
I also wonder if this tool is available in the CPAN somwhere. But i digress...
(updated node: got confused about \s and such, sorry)
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)
|
|---|