http://qs321.pair.com?node_id=640608


in reply to Re^2: HTML::Entities - encode all non-alphanumeric and foreign chars?
in thread HTML::Entities - encode all non-alphanumeric and foreign chars?

$encoded = encode_entities($input, '\\W'); # note double backslash

Single backslash works for me. Sure you weren't trying with a double-quoted string?

('\w', '\\w', "\\w" should all be the same string, \w — whereas "\w" is just w.)

Oh, and the same goes for \s. It should Just Work in a single-quoted string, but in a double-quoted string, you'll need to double the backslash.

print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!