sub hasAccents($) { my($a) = @_; return $a =~ m/[\x7F-\xFF]/s } sub exampleUse() { my $a = "line one\nhello\x88"; if (hasAccents($a)) { print "There are accents\n"; else { print "Just regular ASCII\n"; } }
Programming Tips - Best way to detect accented characters in a Perl string?
Date: 2011aug13
Language: perl
Q. Best way to detect accented characters in a Perl string?
A. Use the ever powerful match: