- 论坛徽章:
- 0
|
回复 #1 afeiguo 的帖子
open FILEHANDLE, MODE, EXPR
The available modes are the following:
mode operand create truncate
read <
write > ✓ ✓
append >> ✓
Each of the above modes can also be prefixed with the + character to allow for simultaneous reading and writing.
mode operand create truncate
read/write +<
read/write +> ✓ ✓
read/append +>> ✓
With "+>>" is READING and APPENDING mode But you must RESET the pointer position with seek()!
For example:
open F, '+>>', 'file.txt';
seek F, 0, 0;
while (<F>) {print $_;}
print F 'something new', "\n";
close F |
|