I am trying to replace many array element with another corresponding array element in a file, but its taking ages to execute. Is there a simpler approach ? Below is my code:
open( my $in, '<', "Test.txt") or die "cannot open Test.txt $!";
open( my $out, '>', "TestFinal.txt") or die "cannot create TestFinal $!";
while( <$in>)
{
for(my $i=2 ; $i<=$LastRowGlossary; $i++)
{
s/$variable[$i]/$vardescription[$i]/g;
}
for(my $j=2 ; $j<=$LastRowTable; $j++)
{
s/$COVERAGE_TYPE_CODE[$j]/$TCOVERAGE[$j]/g;
s/$CVG_TEST_CRIT_CD[$j]/$TCVG_TEST_CRIT_TYP[$j]/g;
}
print {$out} $_;
}
close $in;
close $out;
Please advise.