One-hundred lines, same dealy-o with identical output, but inspired to minimize content by maximizing subroutine recursion. Contribution by myself, a new to perl newbie, yet seasoned programmer playing now with a headless Raspberry Pi via PuTTY on a msVista laptop. Thanks strangedoc, your example poetry helped me learn function calls and for loops, jumping ahead from Padre/absolute_beginner/05_do_it_again.pl
It contains one kludge, failing elegance, I couldn't figure out how to make the newline \n print from the word list which forced me to use "if($j==44)" (a position) along with an "else" when I'd rather instead print the 44th value "\n", but at least I'm halfway along the right track I had in mind - stripping out hard coded 'print "\n";' lines by changing them to tokens in the data stream.

#!/usr/bin/perl # Kurt Schwind: A little of KC's Sunshine # http://www.futuretg.com/FTHumanEvolutionCourse/Audio/English/KC_&_Th +e_Sunshine_Band/KC_&_The_Sunshine_Band_-_Shake_Your_Booty.mp3 use strict; use warnings; my @l = qw( a aah best booty can chance come dance do don't down duty everybody feeling feelings fight floor get give home I in it let's momma now Oh on run shake sister tell the to very well with world yeah you You your You're yourself /n); sub line { my $j = shift; while(defined $j ) { if($j==44) { print "\n"; } else { print " ".$l[$j]; } $j = shift; } } sub sh { my $sh = shift; for(1..$sh ) { line (29); } } sub yb { line (41,3,44); } sub syb { my $m = shift; for(1..$m ) { sh(1); yb(); } } sub refrain { for(1..2) { sh(6); line (44); syb(2); } line(44); } sub groove {sh(5); yb(); }; line (1,12,17,27,32,16,23,7,44,9,15,41,14,18,43,0,5,44,44); refrain(); line (1,39,4,39,4,8,22,34,35,44,42,32,2,21,32,37,20,4,31,44,44,26,44); + refrain(); line (26,38,44); sh(4); line (44,1); sh(4); line (44,44,1,44); refrain +(); line(1,44); groove(); line(1,9,15,32,13,44); groove(); line(1,18,43,0,5,44,44); groove(); line(42,4,8,22,8,22,44); groove(); line(6,19,36,24,25,44); groove(); line(44); groove(); line(1,28,10,33,30,44); sh(4); line(27,41,3,44,1,8,41,11,44); sh(4); line(44,44);

--
"I am a sniveling internet programmer, I have a code in my nodes." —(0=8> wiz.

In reply to Re: KC's Sunshine (not an original poem) by DisneyWizard
in thread KC's Sunshine (not an original poem) by KurtSchwind

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.