Hello Leon,

Tuesday, January 01, 2002, Leon <[EMAIL PROTECTED]> wrote:

>> Can you open a file for reading and writing as the same time?
yes.

L> I have asked the question of can I read and write to the same file
L> simultaneously, such as this :-
L> open FILE, 'myfile.txt' or die "$!\n";
L> open FILE2, '>>myfile.txt' or die "$!\n";
L> while (<FILE>){
L>         # do some changes to $_;
L>         print FILE2 $_;
L> };

L> but I did not get any response. Therefore I dont think we can do that.
check
perldoc -f open
for "+", ">", ">>" modifiers.
and, may be you should check 'seek' function.
perldoc -f seek

"You  can't usually use either read-write mode for
updating  textfiles,  since they have variable length records. See the
-i switch in the perlrun manpage for a better approach." - you are warned.

as usual, you can use temporary files as a i/o buffer.

Best wishes,
 Maxim                            mailto:[EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to