agynr has asked for the wisdom of the Perl Monks concerning the following question:
Cau plz suggest any further Improvement that can be done . P.S. The $target_data can contain 100000 bytes anf the required $pattern can be found many a times.seek(INPUT,$start_offset_target,0); sysread(INPUT,$target_data,$end_offset_target-$start_offset_target+1 ) +; while ($target_data=~m/$pattern/gi) { $space=''; $c=0; $m = $1; + while($m=~/(\n)/gi) { $c+=1; } $space=' ' x $c; $space.=' ' x length($m); $target_data=~s/$pattern/$space/i; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Replacing the pattern to search for
by mkirank (Chaplain) on Jan 18, 2005 at 13:26 UTC | |
|
Re: Replacing the pattern to search for
by sasikumar (Monk) on Jan 18, 2005 at 11:44 UTC | |
by agynr (Acolyte) on Jan 18, 2005 at 11:52 UTC | |
by sasikumar (Monk) on Jan 18, 2005 at 12:05 UTC | |
|
Re: Replacing the pattern to search for
by TedPride (Priest) on Jan 18, 2005 at 15:46 UTC |