Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

my @chickens

by pjf (Curate)
on Oct 04, 2001 at 06:33 UTC ( [id://116627]=poem: print w/replies, xml ) Need Help??

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.

Cheers,
Paul

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. :)

      Cheers,
      Paul

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.

      Cheers,

      Paul

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
    Goldeneye
    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.

      buckaduck

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: poem [id://116627]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-10-05 00:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (43 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.