Put a unique marker in the file eg <PATTERN> where you want the substitution.
#!/usr/bin/perl
use strict;
use warnings;
my $infile1 = 'file1.txt';
my $infile2 = 'file2.txt';
my $outfile = 'result.txt';
#open IN,'<',$infile1 or die "$infile1 : $!";
#my @file1 = <IN>;
#chomp(@file1);
#close IN;
my @file1 = qw(10000000 00000011
10000001 11000000 01100000 );
#open IN,'<',$infile2 or die "$infile2 : $!";
#my @file2 = <IN>;
#close IN;
my @file2 = <DATA>;
open OUT,'>',$outfile or die "$outfile : $!";
for my $pattern (@file1){
print "Test pattern is $pattern\n";
for (@file2){
my $line = $_; # copy to preserve @file2
$line =~ s/<PATTERN>/$pattern/;
print OUT $line;
}
}
close OUT;
__DATA__
SCAN_TEST =
pattern = 0;
apply "grp1_load" 0 =
chain "chain1" = "010";
end;
force "PI" "<PATTERN>" 1;
measure "PO" "10" 2;
pulse "/CK" 3;
apply "grp1_unload" 4 =
chain "chain1" = "010";
end;
poj