Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 rifling through the Monastery: (3)
As of 2024-06-24 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    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.