Willem <wil...@toad.stack.nl> writes: > Eli the Bearded wrote: > ) In comp.lang.perl.misc, Willem <wil...@toad.stack.nl> wrote: > )> In Perl, it would be applicable. You see, in Perl, you can call a function > )> in the replacement of the regex substitution, which can then look up the > )> html entity and return the wanted unicode literal. > ) > ) A function? I'd use a hash. > > A function can return a sensible value for unknown substitutions.
You can do that also in the RHS of the substitution and still keep it readable if you use something like s{..}{ your code goes here }ge; However, a function can be easier on the eye: s{...}{ some_good_name( ... ) }ge; -- John Bokma j3b Blog: http://johnbokma.com/ Perl Consultancy: http://castleamber.com/ Perl for books: http://johnbokma.com/perl/help-in-exchange-for-books.html -- http://mail.python.org/mailman/listinfo/python-list