in reply to Reaped: Replace text in one file with text from another
#!/usr/bin/perl use warnings; use strict; my $infile = 'test.txt'; open INFO, '<', $infile or die "could not open '$infile' $!"; open FILEA, '<', 'outputfromvariantparser1.txt' or die "could not ope +n 'outputfromvariantparser1.txt' $!"; open FILEB, '>>', 'output.txt' or die "could not open 'output.txt' $!" +; my @raw_data = <FILEA>; while ( my $line = <INFO> ) { $line =~ s/TEXT TO BE REPLACED.*/$raw_data[0]/s; print FILEB $line; push @raw_data, shift @raw_data; }
|
|---|