in reply to Search/Replace Character
As already said, the third paramenter to substr is the length of the addressed substring.
But for the sake of diversity, here a regex that would work:
# ... for my $line (@lines) { print $line; $line =~ s/^(.{11})DC/\1 /; print MYOUTPUTFILE $line; } # ...
And if your script is just for filtering text files you could even reduce the whole thing to a simple command line (if you have a shell, that is):
elmex@home: ~# cat file.txt.mrk | perl -ne 's/^(.{11})DC/\1 /; pri +nt' >> test.tmp
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search/Replace Character
by moritz (Cardinal) on Apr 17, 2008 at 15:46 UTC | |
|
Re^2: Search/Replace Character
by rhiannasilel (Initiate) on Apr 17, 2008 at 18:59 UTC |