123
use locale; use utf8;$safestring =~ s/[\p{IsDigit}\p{IsAlpha}]/_/g;
1234
use POSIX;use locale;$safestring =~ s/[[:IsDigit:][:IsAlpha:]]/_/g;