Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

kids song

by ciderpunx (Vicar)
on Nov 08, 2007 at 11:32 UTC ( [id://649692]=poem: print w/replies, xml ) Need Help??

I've had this kids classic stuck in my head all morning. I thought that rewriting it in perl may help budge it.
Update: It didn't.
#!/usr/bin/perl @num = qw|zero one two three four five six seven eight nine ten|; for (1..10) { print mow($_) . " went to mow,\nwent to mow a meadow\n"; print mow($_) . ( $_ == 1 ? " and his dog\nwent to mow a meadow\n" : ", " ) for (reverse 1..$_); } sub mow($) { "$num[$_] m" . (shift == 1 ? 'a' : 'e') . 'n'; }
--
Linux, perl, punk rock, cider: charlieharvey.org.uk.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2025-06-18 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.