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