I'm playing around with de-construction and re-construction given a lyrics text file, to and from a pair of "transporter" files; an alphabetically sorted word list (The tokens, with the zero position set to '/n' newline,) and a token instance order array with which to pick the words in their original order, using zero as the token for new line.

I still haven't got the \n to print from the token list, but the data sequence code was improved by incrementing each word shift up by one, allowing the CRLF to occupy the proper zero position, allowing the code logic (now inverted) if…else statement to take advantage of the zero with shortened comparison - I've always striven to reduce comparisons to their base. Why use 'if(x<>0)' when 'if(x)' is more versatile?. Why limit to Boolean when a range is available? 'if(x-3)' is also faster than 'if(x!=3)' and now three results are valid - negative, zero, and positive.

#!/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(\n 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); sub line { my $j = shift; while(defined $j ) { if($j) { print " ".$l[$j]; } else { print "\n"; } $j = shift; } } sub sh { my $sh = shift; for(1..$sh ) { line (30); } } sub yb { line (42,4,0); } sub syb { my $m = shift; for(1..$m ) { sh(1); yb(); } } sub refrain { for(1..2) { sh(7); line (0); syb(3); } line(0); } sub groove {sh(6); yb(); }; line (2,13,18,28,33,17,24,8,0,10,16,42,15,19,44,1,6,0,0); refrain(); line (2,40,5,40,5,9,23,35,36,0,43,33,3,22,33,38,21,5,32,0,0,27,0); ref +rain(); line (27,39,0); sh(5); line (0,2); sh(5); line (0,0,2,0); refrain(); l +ine(2,0); groove(); line(2,10,16,33,14,0); groove(); line(2,19,44,1,6,0,0); groove(); line(41,5,9,23,9,23,0); groove(); line(7,20,37,25,26,0); groove(); line(0); groove(); line(2,29,11,34,31,0); sh(5); line(28,42,4,0,2,9,42,12,0); sh(5); line(0,0);
"I am a sniveling internet programmer, I have a code in my nodes." —(o=8> wiz.

In reply to Re^2: 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.