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!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: HTML::Entities - encode all non-alphanumeric and foreign chars?
by punch_card_don (Curate) on Sep 23, 2007 at 20:33 UTC |
In Section
Seekers of Perl Wisdom