use strict; my $file_name="c:\\temp.txt"; open (FH,"$file_name"); my $pattern="some thing"; my $c=0; my $space=' '; my $line; while(<FH>) { $line=$_; #current line $c++; #counts the number of lines $space=' ' x $c .' ' x length($pattern); #pattern that has to be r +eplaced $line=~s/$pattern/$space/i; }
In reply to Re^3: Replacing the pattern to search for
by sasikumar
in thread Replacing the pattern to search for
by agynr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |