CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Reading & writing variables to a datafile

 



ee91gg
Deleted

Apr 24, 2000, 5:03 PM

Post #1 of 2 (433 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?


ee91gg
Deleted

Apr 24, 2000, 8:52 PM

Post #2 of 2 (433 views)
Re: Reading & writing variables to a datafile [In reply to] Can't Post

ahh...

\$ is what i need

sorry to have wasted so much space on this board.

;-)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives