<-Back to home
<-Page à Aurélie
<- Computer cheat sheet
<- Fiche Info

Filtre Perl / Perl Filter



#!/usr/bin/perl -w

if($ARGV[0] eq ""){
  print "usage: AccentRemover myfile\n";
  print "Replaces accentuated letters by non accentuated\n";
}
else{
  my $file = $ARGV[0];
  open(IN,"$file") || die "cannot open $file\n";
 
  while(<IN>){
    chomp;
    $line=$_;
   
    if($line ne ""){
  $line=~s/||/a/g;
  $line=~s/|/i/g;
  $line=~s/|||/e/g;
  $line=~s/||/u/g;
  $line=~s/|/o/g;
 
  print"$line\n";
  }  
  } #end while
  close(IN) || die "cannot close file";
}
January 2003