in reply to Re: File I/O
in thread File I/O
your attempt only opens the file for read, not write.open RECORD_NUMBER, '<', "counter_data.dat" or die; $count = <RECORD_NUMBER>; close RECORD_NUMBER; $count++ open FILE, '>', "counter_data.dat" or die; print FILE $count; close FILE;
I see most people answered along these lines. It is worth mentioning open '+<' mode too, although in that case one would have to seek as well.
|
|---|