use utf8; binmode(STDOUT, ':utf8'); my $data = "Euro €"; print "Character count: ", length($data), "\n"; $data =~ s/(\W)/[$1]/g; print $data, "\n";