in reply to Substituting Variables while reading text file
The problem is probably that you are using a bare word instead of a string. Try changing:
to$VAR = TEMP_VAR
and it should work. My quick test with a Perl one-liner under Unix:my $VAR = "TEMP_VAR";
My understanding is that this is closer to what the OP wanted than s///, but I may of course be wrong.$ echo 'create variable $VAR alarm_object 0' | perl -e '$VAR = "TEMP_V +AR"; while (<>) { chomp; eval (qq{print "$_\n";});}' create variable TEMP_VAR alarm_object 0
|
---|
In Section
Seekers of Perl Wisdom