I have a text file as below and saved it as "file.txt"
"create variable $VAR alarm_object 0"
I am trying to read this in a perl script and printing it by substituting the "$VAR" variable
$VAR = TEMP_VAR
open (FILE,"<", "file.txt") or die $!;
while (<FILE>) {
chomp;
eval(print "$_\n");
}
close (FILE);
I need the output as
"create variable TEMP_VAR alarm_object 0"
I tried to achieve this using eval function. It is not working as expected.
How can i achieve this in perl?