in reply to File Truncation Problem


I tried this on Linux and it behaved as expected.

In fact I unit tested this for variety of cases when I posted it here based on PrakashK's solution. ;-)

As such the problem probably arises from the fact that the Dos newlines are being converted to "\n" when they are read. Try to binmode() the file handle and run the program again.

open my $fh, "+<$file" or die "$!"; binmode $fh; ...

--
John.

Replies are listed 'Best First'.
Re: Re: File Truncation Problem
by The_Rev (Acolyte) on Dec 13, 2002 at 14:49 UTC
    Thanks for the code jmcnamara.