全角英数→半角英数(電話番号などの正規化)

#!/usr/bin/perl
use utf8;
use Encode;
use CGI qw(:all);
my $string = 'ABCあいう03-1234-5678__ー-─ー___';
$string =~ tr/A-Za-z0-9-─ー_/A-Za-z0-9\-\-\-_/;
print CGI->header(-charset=>'utf-8', -type=>'text/plain');
print encode('utf-8', $string);

Leave a Reply