use strict; while () { s/( \w) /$1/g; print; } __DATA__ 3851 A A G G T T 3854 A A G G T T