in reply to YET another regexp puzzle
Since this is so much fun, let's do one that uses both the regex and the substr :)
my $word = 'jigglewort'; print $word, "\n"; while ($word =~ /(.)(.)/g) { my $tmp = $word; substr($tmp, pos($word)-2, 2) = "$2$1"; print $tmp, "\n"; pos($word) = pos($word) - 1; } =for output jigglewort ijgglewort jgiglewort jigglewort jiglgewort jiggelwort jigglweort jiggleowrt jigglewrot jigglewotr =cut
|
|---|