This is my first attempt at Obfuscation. Any advice would be helpful.

use strict;my @list = ('116','111','109','109','111','110','116','101' +);&show; @list[0] = @list[7];@list[1] = '114';@list[2] = '103';@list[3] = @list +[4];@list[4] = '119'; @list[5] = @list[3];@list[6] = '108';@list[7] = '102';&show;sub show { +foreach (@list) { print chr($_);}print "\n";} # this prints out my name and my alterego

Replies are listed 'Best First'.
RE: First attempt!
by merlyn (Sage) on Apr 30, 2000 at 18:50 UTC
RE: First attempt!
by turnstep (Parson) on May 01, 2000 at 17:43 UTC
    To be honest, it was not very obfuscated - I was able to deduce what it printed right away. (blame my C experience for actually knowing the decimal characters!). Obfuscated code should be very hard to decipher. Basically, you want to do the oposite of all the "good coding" rules. Don't use something self-explanatory like "@list and &show." Use funky quoting schemes (qq! etc.) instead of plain quotes. Don't put all your array element transpositions and assignments in order (you change $list[0], then $list[1], $list[2], etc. Play around with seldom used features, strange side-effects, and some of the variables that people seldom use like $^A or $,. Misdirect, and make people think the code is doing one thing while it is doing another. Throw in bits that don't do anything useful at all. Don't do things the "standard" way. And it's probably best not to use strict - it severly limits all the tricks and pseudo-legal expressions that form good obfuscated code. Just some quick thoughts...
      I believe in programming with simplicity so obfuscating is a tough concept for me to grasp. Thank you for the ideas. I will write a second version soon.
RE: First attempt!
by httptech (Chaplain) on May 01, 2000 at 17:11 UTC
    Hrm, to me, good obfuscation is compressed as much as possible, with 1-letter subroutine and variable names, and as little whitespace as possible. And gratuitous use of the "map" function is always good. :)

    So I would do something like:

    @l=(116,111,109,109,111,110,116,101,10);&s; $l[0]=$l[7];$l[1]+=3;$l[2]-=6;$l[3]=$l[4];$l[4]+=8; $l[5]=$l[3];$l[6]-=8;$l[7]++;&s;sub s{print(map{chr($_)}@l)}
      Thats better, but assigning to $l[0] through $l[7], you might as well do it with the ()=() structure. Also, obfuscate the first assignment a little.
      @l=split/2/,q;1021012116211021112109210921112116; ;@l=reverse@l;&s;@l=($l[7],114,103,$l[4],119,#=3, $l[1],108,102,10);&s;sub s{print(map{chr($_)}@l)}