in reply to Transposition of each letter pair in string
Ciao, Gregor (Edit: forgot newline)$string = "thisisatest"; @a=split //,$string; foreach (0..(@a-2)) { ($a[$_],$a[$_+1])=($a[$_+1],$a[$_]); print @a."\n"; ($a[$_],$a[$_+1])=($a[$_+1],$a[$_]); }
|
|---|