Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

kids song

by ciderpunx (Vicar)
on Nov 08, 2007 at 11:32 UTC ( #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
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? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2020-09-27 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (142 votes). Check out past polls.

    Notices?