in reply to Inserting a character to a line

Two approaches come to mind:
substr($x, 4, 0, "."); # method 1 $x =~ s/\A(....)/$1./; # method 2
The second approach can also be implemented with sed:
sed -e 's/^(....)/\1./'
Anchoring the regular expression using ^ may not be necessary depending on your situation.

Replies are listed 'Best First'.
Re^2: Inserting a character to a line
by pinpe (Novice) on Mar 22, 2008 at 01:41 UTC
    Hi pc88mxer, Cool!! method 2 works on me! Tnx bro! Br, Pete