Nice, but why not use $1 instead, and thus avoid the "evil variable" $& ?
s/(.)/sprintf('&#%03d;', ord($1))/ge; [download]
the lowliest monk
In reply to Re^2: html2code.pl by tlm in thread html2code.pl by tcf03