in reply to File Access
You may also want to use flock depending on your applications.#!perl -w use strict; my $filename = "notes.txt"; if (-e $filename) { open NOTES, '+< ' . $filename or die "Cant open $filename: $!\n"; } else { open NOTES, '+> ' . $filename or die "Cant open $filename: $!\n"; } print NOTES "foo\n"; seek NOTES, 0, 0; $data = <NOTES>; print $data;
|
|---|