in reply to YET another regexp puzzle

Have you thought about doing this with a slice?

my $str = "jigglewort"; my @a = split //, $str; print join('',@a[0..$_-1, $_+1, $_, $_+2..$#a]),"\n" for 0..$#a;
And the output is as expected -
ijgglewort jgiglewort jigglewort jiglgewort jiggelwort jigglweort jiggleowrt jigglewrot jigglewotr jigglewort

Replies are listed 'Best First'.
Re: Re: YET another regexp puzzle
by carric (Beadle) on Nov 20, 2003 at 03:12 UTC
    Excellent! That looks like it would kick it too.
    THANKS!!