Not exactly a classic obfuscation, it's even clearly formatted, but fun with closures anyway.
This is my first post in this section, so I'm not sure if it's entirely appropriate, please be kind.
my $p = sub { my $n = 2; my $g = sub { $n++ }; sub { my $r = $g->(); $g = sub { my ($f, $g) = @_; sub { while (1) { my $r = $g->(); return $r if $r % $f; } }; }->($r, $g); $r; }; }->(); while ((my $n = $p->()) < 500) { print "$n\n"; }
-----
Bill H
perl -e 'print sub { "Hello @{[shift]}!\n" }->("World")'

Replies are listed 'Best First'.
Re: fun with closure
by billh (Pilgrim) on Apr 27, 2006 at 21:40 UTC
    Explaination moved to spoiler
    -----
    perl -e 'print sub { "Hello @{[shift]}!\n" }->("World")'