in reply to Regex to encode entities in XML

Maybe I'm missing something here, but have you looked at HTML::Entities? If you don't want to include another module, you could probably rip out the necessary guts from it to do what you want, but it's a pretty light-weight module anyway.



If God had meant us to fly, he would *never* have give us the railroads.
    --Michael Flanders