use strict; open (JE, "< c:\\tuls\\tuls.txt") || die "Can not open the file "; my $ou; while () { $_=~s/findtext/changetext/g; $ou.=$_; } close(JE); open (JE, "> c:\\tuls\\tuls.txt") ; print JE $ou; close (JE);