in reply to Modify file without any temp variable

Your version works fine. The following is a little more succinct:

use strict; use warnings; my $fileName = "test.txt"; open (JE, "+< $fileName") || die "Can not open the file "; my $ou = join "", <JE>; $ou=~s/findtext/changetext/gs; seek JE, 0, 0; print JE $ou; close (JE);

Perl is Huffman encoded by design.

Replies are listed 'Best First'.
Re^2: Modify file without any temp variable
by tulsyan (Beadle) on Jul 20, 2005 at 07:32 UTC

    Can you tell me about the seek

      seek = Sets FILEHANDLE's position

      Go thorough seek