... rare tree, rattlin' tree.

Ever heard "Rattlin' bog" before? If not, google for it, a nice example of recursive song ;) And here's a script that will spew out lyrics for it.

Forgive me if these are not 100% correct, I'm not an English native speaker.

#!/usr/bin/perl -w @slowa = ( [ "bog", "in" ], [ "hole", "in" ], [ "tree", "on" ], [ "bough", "on" ], [ "limb", "on" ], [ "branch", "on" ], [ "twig", "on" ], [ "leaf", "on" ], [ "nest", "in" ], [ "bird", "in" ], [ "egg", "in" ], [ "yolk", "in" ], [ "chick", "on" ], [ "wing", "on" ], [ "feather", "on" ], [ "flea", "on" ], [ "eye", "on" ], [ "germ", "on" ], [ "amoeba", "on" ], [ "paramecium", "on" ], [ "virus", "in" ], [ "subatomic particle", "in" ] ); while($foo = $slowa[++$i][0] ) { # refren print "Oh'ro the rattlin bog / ", "and the bog down in the valley o'\n", "Rare bog, rattlin bog / ", "and the bog down in the valley o'\n\n"; push @spiewam, $foo; print " \u$slowa[$i-1][1] that $slowa[$i-1][0] there was a $foo\n", " Rare $foo, rattlin' $foo\n\n"; $j = @spiewam; foreach $bar (reverse @spiewam) { print("\t", ( map {$j == @spiewam ? ucfirst : "And $_"} $bar) , " $slowa[$j-1][1] the ", "$slowa[$j-1][0],\n"); $j--; } print (($i == @slowa-1 ? "\tAnd t" : "\tT"), "he bog down in the valley-o'.\n\n"); }
Hope you enyojed it ;>

In reply to In that bog there was a tree... by yacoob

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.