http://www.perlmonks.org?node_id=240273


in reply to Stripping characters...

To create a complementary character class, use [^...], see perlre. In order to strip characters, tr/// is the better (=more efficient) choice:

$string =~ tr/a-zA-Z//cd;

See perlop for what tr///cd does.

--
http://fruiture.de