
ee91gg
Deleted
Apr 24, 2000, 5:03 PM
Post #1 of 2
(220 views)
|
|
Reading & writing variables to a datafile
|
Can't Post
|
|
Hi, As i think cure mentioned to someone previously, it's possible to put require "some.data.file"; in a script to retrieve stored variables. I then want to take these variables, change them, and rewrite them back to the data file to update them each time the script is run. The file should look like this; $var1 = 'string'; $var2 = 3; etc.. But how do i pattern match the variables on each line? That is to say find the line starting with; $var1 and replace with; $var1 = 'new string'; If these lines start with a $ won't perl misinterperete that? Won't perl also misinterprete; print DATAFILE "$var1 = 'new string';"; won't it instead print; string = 'new string'; or is there a better way of doing this kind of thing?
|