Me Again :) - Help with the Open command
Can someone just inform me of the different *things* with open.
To open a .txt for just reading you go like this:
open(variables,"<variables.txt");
Right?
What do I use to:
Open and Overwrite a .txt
and
Open and write at the bottom(or top) new info for a .txt?
Anonymous posted this at 20:00 — 17th May 1999.
They have: 5,633 posts
Joined: Jan 1970
to overwrite:
open(FILE,">variables.txt" ) ;
to append:
open(FILE,">>variables.txt" ) ;
to the top of the file doesn't work, you have to read the whole data, push your input into it, and write it back.
don't forget to chmod!!!
and before you ask:
to write to an opened file:
print FILE
"blah blah.........
cu
patrick
John Pollock posted this at 20:01 — 17th May 1999.
He has: 628 posts
Joined: Mar 1999
Dass:
This URL should help you out. It explains the writing and appending of files:
http://www.extropia.com/faq/perl_faq.html#write
----------
John Pollock
http://www.pageresource.com
Java Script: A Beginner's Guide
Page Resource
Dass posted this at 21:30 — 17th May 1999.
They have: 109 posts
Joined: Apr 1999
uhhh..Whats chmod heh?
Anonymous posted this at 22:25 — 17th May 1999.
They have: 5,633 posts
Joined: Jan 1970
on a unix-based system, a script needs to have permissions, e.g. to be executed when you want to run it from your browser, or to write new files..... and so on.
i recommend the tutorial at cgi101.com
there you'll find everything you need for your first script and how to make them run on the server...
if you learn this basic-knowledge about using cgi and perl, you won't have that much problems in the future
Dass posted this at 23:58 — 19th May 1999.
They have: 109 posts
Joined: Apr 1999
To print to a file that is already open, do you have do go
print FILENAME $variable;
or can you just go
print $variable;
Anonymous posted this at 00:42 — 20th May 1999.
They have: 5,633 posts
Joined: Jan 1970
this would print your variable in the browser window.....
cu
patrick
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.