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
In reply to Re: YET another regexp puzzle
by Coruscate
in thread YET another regexp puzzle
by carric
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |