in reply to Replacing the pattern to search for
use strict; use warnings; my $path = "c:\\temp.txt"; my $pattern = "some thing"; my $handle; open($handle, $path); my @data = <$handle>; close($handle); my $c = length($pattern); for (@data) { $c++; $_ =~ s/$pattern/' ' x $c/ei; } open($handle, ">$path"); print $handle @data; close($handle);
|
|---|