Here is my first try at obfuscation; any suggestions? It passes both use strict and -w.
my$a=q&&;my$i=q ;uJts natoehr ePlr ahkcre.;;my $j=q; s@([a-z])([a-z])@$2$1@ig;; @_=split( /\s/,$i);foreach (@_){ eval($j); $a.= $_.q; ; ;}print $a."\n" ;

Replies are listed 'Best First'.
RE: A first attempt
by Adam (Vicar) on Oct 28, 2000 at 01:52 UTC
    Its a good start. I give it a ++.

    Some ideas: You don't need to my the $a ($a is a magic variable used by sort.) I might try the same approach like this:

    $_=q; uJts natoehr ePlr ahkcre.;; $a=q#s<([a-z])([a-z])>@$2$1@ig;; #;eval($a)=>$b.=qq=$_ =for split;print $b,$/
      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
        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.