Better to use a proper module like Text::Undiacritic
=)
#!/usr/bin/perl
use warnings;
use strict;
use utf8;
binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");
use Text::Undiacritic qw(undiacritic);
my $string = "C'est l'été à Paris ?\n";
print undiacritic $string;
OUTPUT:
C'est l'ete a Paris ?
NOTE
As far as you asked string with accent, undiacritic()
will work removing accents, but will not work by example on typographic ligature. If you pass the string
C'est l'été à Paris Lætitia ?
it will not substitute æ
Welcome in the real tricky world: Unicode-UTF8. A good pointer