I Have a problem with a Perl script that reads a line from a file which has variable names in it and when it prints the variable names are printed as a literal.
the line in the file:
$var01 blah blah blah $var02 blah blah
in the script:
$var01 = "name1";
$var02 = "name2";
$line1 = <INF>;
print "<P> $line1 </P>";
this prints the line just as is in the file:
<P> $var01 blah blah blah $var02 blah blah </P>
Is there a way to make the script print the contents of the variables instead of just the variable itself?
What I need is:
<P> name1 blah blah blah name2 blah blah </P>
Could anyone be so kind as to help me with this?
Thank you in advance for your cooperation
something like this:
$filetext =~ s/\$var01/$var01/g;
Thank you very much LuZeR,
I just tried it and it works great, I guess is about people like you that the Perl man pages refer as members of the Perl culture and their readiness to help.
I'm just starting with Perl and I guess it would have taken me quite a while to get to the proficiency level to find out about the answer to that one.
Thank you for your cooperation and be well.