open(FH, "+<", "$filename") or die "Opening: $!"; @ARRAY = <FH>; # change ARRAY here seek(FH,0,0) or die "Seeking: $!"; for($i=0;$i<=$#ARRAY;$i++) { $line = $ARRAY[$i]; $line=~s#find#replace#; $ARRAY[$i] = $line; } print FH @ARRAY or die "Printing: $!"; truncate(FH,tell(FH)) or die "Truncating: $!"; close(FH);
regards
Franklin
Don't put off till tomorrow, what you can do today.
In reply to Re: open file for read/write
by l.frankline
in thread open file for read/write
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |