Subject: my first perl hack
From: [email-masked] (Greg Alt)
Date: 13 Oct 93 03:16:58 MDT
Newsgroups: alt.hackers

I kept hearing about perl, and it sounded interesting, so I finally got 
around to trying it out.  Here's my first perl program:

#!/usr/bin/perl
if(@ARGV){$w=int(shift(@ARGV)/2)*2+1;$h=int(shift(@ARGV)/2)*2+1;}else{$w=81
;$h=25;}$m=' 'x$w.(' '.'#'x($w-2)." ")x($h-2).' 'x$w;main:for(substr($m,$p=
2*$w+2,1)=4;$v!=4;){$o=$v=int(rand(4));do{substr($m,$p+$d,1)=' ',substr($m,
$p+=2*$d,1)=$v,next main if(substr($m,$p+2*($d=((($v&2)?1:-1)*(($v&1)?1:$w)
)),1)eq'#')}while($o!=($v=($v+1)%4));$v=substr($m,$p,1);substr($m,$p,1)=' '
;$p-=2*((($v&2)?1:-1)*(($v&1)?1:$w)) if ($v<4);}for($i=0;$i<$w*($h-2);print
substr($m,1+($i+=$w),$w-1),"\n"){}