#!/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"; } } } #### Le Système SAS 243 09:11 Monday, October 29, 2007 The PHREG Procedure Informations sur le modèle Data Set WORK.PSEUDOCONTSAS Dependent Variable time Censoring Variable affstat Censoring Value(s) 0 Ties Handling DISCRETE Number of Observations Read 1162 Number of Observations Used 332 État de convergence