http://qs1969.pair.com?node_id=88939


in reply to letter mix

Couldn't you just do this?
$data1 =~ s/(\S)(\S)/$2$1/g;
This takes two non-space characters in a row, and swaps them.

Perhaps it has slightly different behavior than yours, though. I only tested it on your example.