Is there any perl program that isn't obfuscated? The idea of a "readable perl contest" originally came from Segfault.org, but I think it has serious merit :-)

So, if any of you perl hacker types want to take a crack at writing perl that someone else (even another perl hacker) can understand, add it here.

I'll start:

#!/usr/bin/perl
print("hello world");

Anything more complex than this rapidly becomes unreadable.

It's no surprise that Larry Wall himself indeed won the Obfuscated C Contest twice shortly before perl existed: once in 1986, the other in 1987.

I was looking at the entries awhile ago. The 1986 one doesn't compile with gcc 2.95.2, and it makes me dizzy to try and understand, let alone fix. The 1987 one was even more obfuscated: a Roman numeral conversion filter.
The script from above can be even more simplified:

#!/usr/bin/perl
print "hello world"

  1. The brackets around "hello world" are not required.
  2. The semicolon after the last statement is not required.

Also you can do away with the whole #!/usr/bin/perl deal. Your script ends up looking like this:

print "hello world"

Of course you'll have to run your script like this: perl scriptfile

See how easy it is to read Perl!
#!/usr/bin/perl
OBFUSCATION;
by: Will_Woods;

obfuscation? listen well, child:
tell the world, and rejoice; 
for $perl (can-be) {beautiful};

my $mind = 'clear' and my $thoughts = 'pure', thus;
my $perl = 'readable'. 

$but; if (tired or hurried or lazy) {
  print $perl = 
  (split(//,$thoughts))[1].chr(ord((split(//,$mind))[1])+2).$perl,"\n";
}

# obfuscation; 
# a perl poem by wwoods@cowofdoom.com
# 12/27/2000

(yes, this is actual perl. you can actually run this script. The ugly, second-to-last line prints "unreadable". makes sense, right?)

Log in or registerto write something here or to contact authors.