sorry, i'm a dummy, your script works good, but i've another question: why your script replace only ONE word per line, even i load the array with 16 terms (and i note that there are 3 or 4 lines with at least 2 different terms of the list)? i tried to enbed your script in a large for routine(about 100 times) but it change only one term per line....it's strange....
On Tue, 1 Mar 2005 14:17:23 +0100, Web Solving <[EMAIL PROTECTED]> wrote: > >#!/usr/bin/perl > > > >use strict; > >use warnings; > > > >my $file = 'in.txt'; > >open FH, $file or die qq(Cannot open "$file": $!); > > > >my @replacements; > >while ( <FH> ) { > > next unless m/\|/; > > > > # limit split to just 2 resulting arguments. > > push @replacements, [ split /\|/, $_, 2 ]; > >} > > > >$file = 'in.blah'; > >open IN, $file or die qq(Cannot open "$file": $!); > > > >$file = 'testo_new.txt'; > >open OUT, ">>$file" or die qq(Cannot open "$file": $!); > > > >while ( my $line = <IN> ) { > > foreach my $replacement ( @replacements ) { > > $line =~ s/\Q$replacement->[0]\E/$replacement->[1]/; > > } > > print OUT $line; > >} > > > >close IN; > >close OUT; > > the scipt doesn't work, the result is an un/understandable list of > pipes and uncompiled strings, and $file = 'in.blah'; can't be > compiled. i'm trying to rebuild the script using your suggestions. > byez > Alex > > On Tue, 1 Mar 2005 00:19:52 +0100, Web Solving <[EMAIL PROTECTED]> wrote: > > very thanks, tomorrow morning i'll test it and i'll tell you if it > > works (i'm sure about it)! really thanks for helping me! > > > > Alexander > > > > -- > > WebSolvingJaa: informatica per il web e l'azienda. > > http://websolvingjaa.altervista.org/ > > > > -- > WebSolvingJaa: informatica per il web e l'azienda. > http://websolvingjaa.altervista.org/ > -- WebSolvingJaa: informatica per il web e l'azienda. http://websolvingjaa.altervista.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>