local $/; $/ = "."; open FH, "./testfile"; open OH, "> ./outputfile"; while () { s/^(\W*)(\w)/$1\u$2/; print OH $_; } close FH; close OH;