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
    If you had warnings in effect, you'd get this message:
    \1 better written as $1
Re^2: Search/Replace Character
by rhiannasilel (Initiate) on Apr 17, 2008 at 18:59 UTC
    Thanks for the suggestions. The command line idea will come in really handy. I get a lot of one off text files from my users where a vendor put in a wrong code or put a code in the wrong position and we need to adjust it. This can be a real pain when the file is over 1,000 records or more in some cases.