display | more...

SelfGOL was Damian Conway's entry into the third Obfuscated Perl contest. Though it was entered one year late and was thus disqualified, that's wasn't really the point. The point is that it could have been entered into all categories at the same time! What does it do?

  • self-replicate: SelfGOL is a quine - that is it can print its own source code. Usage: SelfGOL -s
  • make other programs self-replicate: alters other perl scripts so that they return their own source code with the '-s' argument. Usage: SelfGOL <progname>
  • play Conway's Game of Life: uses perl code (its own or another program) to seed the grid and then plays the Game of Life. Usage: SelfGOL -g -x=width -y=height
  • animate short text in a marquee banner: rotates given text and prints it to the screen. Usage: SelfGOL -d="text"

All this in under 1000 characters and without using any if, unless, while, until, for, foreach, goto, next, last, redo, map or grep statements. Only Damian Conway, creater of Lingua::Romana::Perligata (Perl in Latin!) and Quantum::Superpositions (indeterminate variables!), could be insane enough to make this monstrosity. He then had to go on a speaking tour titled "Extreme Perl" to explain how the damn thing works! Here it is, for your pleasure:

#!/usr/local/bin/perl -sw 
if($j){{$^W=$|;*_=sub{$=+s=#([A-z])(.*)#=#$+$1#=g}}     #_The_Perl_Journal_# 
q<#!/usr/local/bin/perl -sw 
if(!$s){>.($_=<>).q<}else{@s=(q[printf+pop@s,@s],q[#!/usr/local/bin/perl -sw 

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