perltutorial marko <B>How do I write messy (and sometimes entertaining code code?</B> <p> The first thing you will probably notice is that this tutorial is a bit Obfuscated. I thought I would match the theme :) Often one may ask how to write highly obfuscated code in Perl. Its easy to write code. But can you write unreadable code? This is a simple tutorial guide, if you want to become a pro, practice your art. <hr> 1) Take advantage of Perl's end of line character ";". Use it to dirty up your code. For example, if you want to go for a certain shape you can use ";"'s to spruce it up:<code> my $cash_in; my $cash_ot ; my $cash_iz ; my $cash_zi ; my $cash_zo ; my $cash_is ; my $cash_if; </code> Languages that use ';' as a "end line" character are generally better for obfuscated because you can mush your code like so:<code> my $var="null\n";chomp($var);if ($var="null"){print "Good";} </code> You can also make an off beat pattern for your ';''s to add a bit of confusion, like so:<code> my $var="null\n" ;chomp($var) ;if ($var="null") {print "Good" ;} </code> <hr> 2) Always break up your equal signs. Ie: <p> Try to do: <code> $myvar = "fdfdjsk"; </code> instead of:<code> $myvar = "fdfdjsk"; </code> <hr> 3) Don't forget that, if you need better "shaping", always break up your strings with a new line character "\n"; <hr> 4) Regular expressions make for messy code, and that is what we are going for. Use them in excess whenever possible. <hr> 5) Add comments. Sometimes adding odd comments here and there can help enhance the shaping of your code. An example of this is found in my work : "modern (perl) art" in the Obfuscated Code section of However,never comment in a way that would clarify your code. <hr> 6) Try to name your variables in a simplistic, yet inconherent way. "woodzy" has done a great job of this with his work called "Email sig. Old news. :/" on For example: <pre> instead of $payroll, try $p instead of $atom, try $a </pre><hr> 7) Keep working. Practice enough and you WILL get good results. Someday you will even do lettering. You don't beleive that thats possible? Check out "Yet Another Perl Conference" by Erudil and you will see what I mean. <hr> 8) Keep your code as mathematical as possible. Never leave a simple expression alone, ie (4+4), but rather turn it into (((1*3)+1) + ((100*((1*2)+2)) /(10*10))). Doing this will make your code unreadable real soon. <hr> 9) Packing and unpacking will cause your code to be just a bit more unreadble. You will find many examples of this in Obfuscated Code board. <hr> 10) Be sure to view some of the code found in Obfuscated Code section of, its real helpfull on giving you some ideas on where to get started at making your code more un-readable. Please note that this is by no means a complete tutorial. I really hope that some other "perl obfuscator" will jump in and write a tutorial much better than this. <hr> Thank you and have a good obfuscated night. <p><small>Edit 2001-04-03 by [tye] <!-- remove <pre> and a whole bunch of <br>s, replace '-'x$n w/ <hr> --></small></p>