in reply to 99 bottles, 2 lines
foreach(1..99){$b="\n$_ bottle@{[$_!=1&&s=>]} of beer";push@a,",\nTake + one down, pass it round,$d@{$d=$b.' on the wall'}\n",$d.$b};print re +verse@a;
I had this great idea using quines and self-modifying code, but I was beaten by s///. The idea was to find every number in the program and decrement it by one with s/\d{2}/$1--/g but $1 is read only so I couldn't (my lesson for today). Oh well. The following code actually works.
Update: I don't know if it's just my browser but the second line isn't displaying correctly. It should be $b=99;$c=$b-1;. But it doesn't break to badly if $c gets mangled.
seek DATA, 38,0; + $_=join("",<DATA>); + $b=99;$c=$b-1; + $b/$b; + print "\n\n $b on the wall, $b. Take one down, pass it around, $c on +the wall." ; + s/$b/$b-1/e; + s/ (\$.)/$1 bottles of beer/g; + eval;__DATA__
____________________
Jeremy
I didn't believe in evil until I dated it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re: 99 bottles, 2 lines
by tye (Sage) on Nov 28, 2000 at 22:03 UTC | |
|
Re: 99 bottles, 2 lines
by o(o_o)o (Scribe) on Jan 08, 2002 at 06:46 UTC | |
by blakem (Monsignor) on Jan 08, 2002 at 06:58 UTC | |
by o(o_o)o (Scribe) on Jan 08, 2002 at 07:05 UTC |