in reply to Transposition of each letter pair in string

perl -le'$s="thisisatest";map{$t=$s;(substr($t,$_,1),substr($t,$_+1,1) +)=(substr($t,$_+1,1),substr($t,$_,1));print $t}0..length($s)-2'
perl -e'$_=q#: 13_2: 12/"{>: 8_4) (_4: 6/2"-2; 3;-2"\2: 5/7\_/\7: 12m m::#;s#:#\n#g;s#(\D)(\d+)#$1x$2#ge;print'

Replies are listed 'Best First'.
Re^2: Transposition of each letter pair in string
by Aristotle (Chancellor) on Dec 29, 2002 at 16:09 UTC
    map in void context? For shame. I don't think the original poster was asking for a golfed solution either. Other than that, the following (substr($t,$_,1),substr($t,$_+1,1))=(substr($t,$_+1,1),substr($t,$_,1)); is equivalent to but harder to read than substr($t, $_, 2) = reverse substr($t, $_, 2); From there it's any easy step to $_ = reverse $_ for substr($t, $_, 2);

    Makeshifts last the longest.