in reply to Re^2: French Accents in perl
in thread French Accents in perl

There are a few problems with that version of the script as posted:

Here's a version that prints the matches, and the output is definitely valid utf8. If the results look wrong when you run it, that probably means you are using a display window that does not support utf8 characters.

#!/usr/bin/perl -w use strict; use Getopt::Std; our ($opt_f); getopts('f:'); if($opt_f){ open( FILE, "<:encoding(cp1252)", $opt_f); binmode STDOUT, ":utf8"; while (my $line = <FILE>) { chomp ($line); print "$line\n"; if ($line=~ /Number\s+of\s+Observations\s+Used\s+(\d+)/ or $line=~ /(État)/){ print "$1\n"; } } }