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


in reply to tr/// vs s/// The question.

tr/[^A-Za-z0-9_ ]//d is the same as tr/A-Za-z0-9_ ]^[//d

tr doesn't pay attention to the brackets and treats them as characters.

You'll have better luck with tr/A-Za-z0-9_ //cd
the c stands for complement, d for delete. See perldoc perlops for more info