I need to read and write to a file before allowing the anyone else to read
or write.
I found this on the web.. but it does not work...maybe its my version of
perl?

http://htmlfixit.com/cgi-tutes/tutorial_Perl_Primer_011_File_manipulation_with_Perl.php
File Operation modes:
open:
<$file&path     Read access only (The same as not specifying a mode.)
>$file&path     Write access, create if nonexistant, and overwrite existing
data.
>>$file&path    Write access, append to existing data.
+<$file&path    Read and Write only, no file creation/appending. Overwrite
existing data.   <<<<<<<<<<<  I tried this one
+>$file&path    Read, Write, Create, overwrites rather then appending.
+>>$file&path   Read, Write, Create, Append, no overwriting.
| SYSCOMMAND    Write data to external command only.
SYSCOMAND |     Read data from external command only.

Anyone know about this? or can I just:
#Open to read
open (DataFile, "$_[0]")||die "Sorry, I can't open $_[0]\n";
  flock (DataFile,2);
   @Data =<DataFile>;
#open to write
 open DataFile, ">$_[0]")||DieNice3("Can't write to $_[0]");
 flock (DataFile,2);
 foreach $Data(@Data)
 {
  print DataFile "$Data\n";
 }
close (DataFile)||die "Sorry, I can't close $_[0]\n";


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to