On Sun, 6 Oct 2002, Arie Folger wrote:

> Hi,
> 
> Assume file q.txt contains one line with the text
>       A = $a
> and I want to read this file in a perl script and substitute the value of $a 
> for '$a' without using a s/\$a/$a/g construct.

why not? if you're afraid that this will replace things it shouldn't, then 
mark the 'substitution parts' with extra text. for eample, i usually mark 
substitution parts with two '%%' marks, such as: "A = %%a%%", and store a
perl-hash of 'macros' that contan the substitutions.

you can also use 'eval' - if the text contains valid perl code.

-- 
guy

"For world domination - press 1,
 or dial 0, and please hold, for the creator." -- nob o. dy


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to