in reply to letter mix

You said you were interested in other, simpler, solutions, so here is mine: simple use of built-ins, but no real attempt at "golfing" it.

—John

while (<DATA>) { chomp; s/(.)(.)/$2$1/g; print "$_\n"; } __DATA__ This is a test. This is the second line. 12ab34cd56ef78gh90ij