I have 2 files one has the input and the other has data that will replace specific string in file 1
eg ---- File 1 --------- Text| to be replaced Text| to be replaced Text| to be replaced Text| to be replaced Text| to be replaced File 2 --------- replaced1 replaced2 replaced3 Output ---------- Text|replaced Text|replaced Text|replaced Text|replaced Text|replaced I have a pgm that works but the output looks like text|replaced1 text|replaced2 text|replaced3 text|replaced1 text|replaced2 Here is the code -------------------------- #!/usr/bin/perl use warnings; use strict; my @array; my @replacearray; open FHR,'<',"repl.txt"; open OUT,'>>',"output.txt"; open IN,'<',"input.txt"; @replacearray=<FHR>; @array=<IN>; for my $i(0..$#array) { $array[$i]=~s/to be replaced/$replacearray[0]/gi; push @replacearray, shift @replacearray; } my @result=grep(/[^\$]/,@array); print OUT @result; Can anyone point out to me what i am doing wrong??Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/