#!/usr/bin/perl use open IN => ':encoding(cp1252)'; use open OUT => ':utf8'; use Getopt::Std; our ($opt_f); getopts('f:'); if($opt_f){ openFile ("$opt_f"); while (my $line = ) { chomp ($line); #the following line illustrates that what is being #read in is transformed from the original text print $line; #if the part in the reg exp below "(État)" is removed, then #the reg exp matches and $1 is printed correctly, but not #with this kept in there if ($line=~ /Number\s+of\s+Observations\s+Used\s+(\d+)\s+(État)/){ print "$1"; print "$2"; } } }