I keep a few chickens in my backyard, and I think I once mentioned that I could code up chicken behaviour in half a page of perl. Well, my poetry is awful, but this compiles and runs happily with a standard perl distro.


use Carp qw/cluck/; my @chickens; sleep until $dawn; cluck $loudly until open $coop; exit $coop; chomp $food and accept($scraps,$seed); shift @straw, pop @eggs and cluck $more; until ($dusk) { seek($many,$worms,$bugs); join flock($other,@chickens) if split /from others/; tell WORLD,"sky is falling" if $airplane; } return 2,$coop and sleep until $dawn;

I can't believe I just posted that.

Replies are listed 'Best First'.
(MeowChow) Re: my @chickens
by MeowChow (Vicar) on Oct 05, 2001 at 07:15 UTC
      I did think of having a "chop $head and die" type verse, but I'm a vegetarian, and really have no desire to eat the poor chooks. So this was an intentional omission. :)


Re: my @chickens
by John M. Dlugosz (Monsignor) on Oct 04, 2001 at 08:18 UTC
    When you run it, it quits at the "exit" line near the top.

    I like it.

      Getting it to reach the exit is a little hard... "sleep until $dawn" tends to sleep a very long time indeed. ;) If only my real chickens would let me sleep in each morning.

      Thanks for the compliment. I'm glad it's been amusing.



Re: my @chickens
by blackjudas (Pilgrim) on Oct 04, 2001 at 22:37 UTC
    I think you've got an excellent imagination, and it compiles too :) ++.
Re: my @chickens
by FlashM (Novice) on Oct 07, 2001 at 09:07 UTC
    You're a nutcase... but I'm glad 'cos it made me laugh... thanks :)
Re: my @chickens
by Elliott (Pilgrim) on Oct 07, 2001 at 21:37 UTC
    After Great Perl Literature, how about Perl Movies?
    $batman=~s/\&//g; print "<A HREF=\"index.html\">Fly</A>"; print "<A HREF=\"javascript:opener.location.href=index.html\;self.clos +e\;\">"; sub marine{$paint="ffff00"} while($u){sleep} sub seattle{while(1==2){sleep}} $i="ffd700"; sub mummy{return} $shark{$colour}="0000ff"; my $love;undef $love; splice(my @best,$friend); $man[2]; @man=qw(grumpy sore indignant huffish bitter aggravated wrathful vexed + ireful enraged furious cross);
    Batman and Robin (Batman "and" robbing - ouch)
    Fly Away Home
    Home Alone
    Yellow Submarine
    While You Were Sleeping
    Sleepless in Seattle
    The Mummy Returns
    Blue Shark Hash
    Goodbye My Love
    My Best Friend's Wedding
    The Third Man
    Twelve Angry Men
      A large collection of Perl movies is already here.