Is there any perl program that isn't obfuscated? The idea of a "readable perl contest" originally came from, 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:

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:

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!
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 = 

# obfuscation; 
# a perl poem by
# 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 register to write something here or to contact authors.