in reply to How do I keep anything other than alphanumeric out of a variable?
Your regex says, "find the alphanumeric characters in $user_name, and replace them with nothing."
You want the opposite:
The ^ at the beginning of the character class inverts the set, i.e. "all things not in this character class".$user_name =~ s/[^a-zA-Z0-9]//g;
|
|---|