Just another Perl shrine | |
PerlMonks |
Re: How do I keep anything other than alphanumeric out of a variable?by Roy Johnson (Monsignor) |
on Nov 04, 2003 at 14:53 UTC ( [id://304434]=note: print w/replies, xml ) | Need Help?? |
The right tool for character classes is tr///, not s///: (You can add the underscore character, or any others you like, of course.) If you wanted the username to look like a valid Perl identifier (i.e., begin with a letter, then alphanumerics + underscores), you would then want to strip off the leading non-letters:
In Section
Seekers of Perl Wisdom
|
|