in reply to Re: French Accents in perl
in thread French Accents in perl
Here is a small illustrative piece of text I am trying to parse using the -f option:#!/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 = <FILE>) { 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: French Accents in perl
by graff (Chancellor) on Nov 03, 2007 at 03:26 UTC |