L
Luc Leemans
A simple substitution in perl is done by
$variable =~ s/string1/string2/i;
$variable =~ s/string3/string4/g;
print $variable;
This works fine but I would have to tailor the program for each specific
case.
I would like to put these is a file D:/TEMP/perlString.txt and then write a
perl program to read and execute them.
I have tried something like this but have been unsuccessful.
Is it even possible?
Basic logic I tried:
my $inFile= "D:/TEMP/perlString.txt";
open(INFILEH, $inFile);
while (<INFILEH>)
{
chomp;
$perlExpr = $_;
$variable =~ $perlExpr;
}
print $variable;
$variable =~ s/string1/string2/i;
$variable =~ s/string3/string4/g;
print $variable;
This works fine but I would have to tailor the program for each specific
case.
I would like to put these is a file D:/TEMP/perlString.txt and then write a
perl program to read and execute them.
I have tried something like this but have been unsuccessful.
Is it even possible?
Basic logic I tried:
my $inFile= "D:/TEMP/perlString.txt";
open(INFILEH, $inFile);
while (<INFILEH>)
{
chomp;
$perlExpr = $_;
$variable =~ $perlExpr;
}
print $variable;