in reply to RE: A first attempt
in thread A first attempt

It's also a good idea to use \w instead of [a-z], even if that also catches upper case and underscores. Random escaped regexp characters are much harder to sync up in your mind than character ranges. So your regexp looks like this:
s<(\w)(\w)>#$2$1#g

Notice how you don't need the /i tag anymore either. Of course, you might as well use /ge if you're using a substitution. Maybe try this:
s<(\w\w)>@reverse split m{},$1@ge


-Ted

Replies are listed 'Best First'.
RE: RE: A first attempt
by Adam (Vicar) on Oct 28, 2000 at 04:44 UTC
    You are, of course, correct! I don't know why I didn't notice that. How about:
    @_=qw=PerlMonksRock!=;$_=q; uJts natoehr ePlr ahkcre.;; $a=q#s<(\D)(\w)>@$+$1@g;;1; #;;eval($a)=>$b.=qq=$_ =for split;;print $b,$/,#@PM.ORG
    By the way, obfuscation is fun because it forces you to learn the more 'obscure' parts of Perl. Half the fun is trying to figure out how it works, and then diving into the library to fill in the gaps. You can find out about all the predefined variables this way too.