Dearest Monks, remember back in the days of DOS when some programs would put in an indicator that the program wasn't locked up but was actually doing something? It was a series of slashes and dashes overlaid over the top of the last so that it appeared to be a "sparkle" Sort of an animated asterisk.

So I was looking through "cool uses for perl" saw a posting with a "Text to animated pseudo-braille GIF" which looks like it would do a similar thing in a gif file. It got me thinking about it again.

So here's what I came up with but it's not very swanky and I have to do a system "cls"; between every display which makes the text flash as well (I'd use something besides cls if I knew how). I couldn't figure out any other way to control what line on the screen the sparkle sparkled on.

# !cqperl (that's all I have here at work) use strict; use warnings; my $count = 0; my @sparkle = qw(\ | / - |); while ($count < 100 ){ my $thingy=shift(@sparkle); system"cls"; print "This is a sparkle: $thingy\n"; sleep .99; push(@sparkle, $thingy); $count++; }
Any ideas? How could I make it better?

Thanks, Gretchen

(aka sparkle farkle) - Oh yeah? Well, if you get the ref you're that old too!


In reply to Creating a Sparkle in perl by gj2666

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.