Very nice. But still not Lazy enough. ;-)

Try this:

use Lingua::EN::Inflect qw/inflect NUM PART_PRES/; use Lingua::Conjunction qw/conjunction/; my @gift = ( '', 'partridge in a pear tree', 'turtle dove', 'French hen', 'calling bi +rd', 'gold ring', 'goose', 'swan', 'maid', 'lady', 'lord', 'piper', 'drummer', ); my @action = map {$_ && PART_PRES $_} ( '', '', '', '', '', '', ' a-lay', ' a-swim', ' a-milk', ' dance', ' a-leap', ' pipe', ' drum', ); for my $day( 1..12 ) { print inflect("On the NUMWORDS(ORD($day)) day of Christmas,\n"), "my true love gave to me:", conjunction( map { NUM($_); inflect "\n\tA(PL_N($gift[$_]))$action[$_]"} reverse 1..$day ), ".\n\n"; }

Which then makes it easy to change it to:

use Lingua::EN::Inflect qw/inflect NUM PART_PRES/; use Lingua::Conjunction qw/conjunction/; my @gift = ( '', 'Swiss Army switch statement', 'style of OO', 'loop type', 'sigil fix', 'catch block', 'junction', 'ref', 'sub', 'type', 'try', 'function', 'less-than', ); my @action = map {$_ && PART_PRES $_} ( '', '', '', '', '', '', ' OR', ' a-bind', ' overload', ' a-check', ' a-catch', ' curry', ' chain', ); for my $apo ( 1..12 ) { print inflect("In the NUMWORDS(ORD($apo)) Perl Apocalypse,\n"), "my Larry gave to me:", conjunction( map { NUM($_); inflect "\n\tA(PL_N($gift[$_]))$action[$_]"} reverse 1..$apo ), ".\n\n"; } ;-)

In reply to Re: Re: Twelve Days of Christmas (with help from CPAN) by TheDamian
in thread Twelve Days of Christmas by ibanix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.