in reply to Transposition of each letter pair in string
My code above did work, but I felt it was clunky and wondered about other approaches, that was all.
For the record, the task was, as achieved above, to produce the array of results generated when you transpose each consecutive pair of adjacent letters: "test" becomes "etst, tset, tets" as first the t and e are transposed, then the e and s, then the s and t -- and the results were just fine. It was just the approach that I wanted you guys to comment on or show me alternatives to.
--
($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;
|
|---|