I rewrote your program before noting the "Bits I'm after" at the bottom -- I thought you wanted style suggestions. HTH, anyway.

#! /usr/bin/env perl use diagnostics; use strict; use Tk; use Time::HiRes; my $BG_COLOUR = $ENV{MY_BG_COLOUR} || "black"; my $FONT = $ENV{MY_FONT} || "-*-Matrix Code NFI-*-*-*--*-200-*"; # http://www.1001fonts.com/font_details.html?font_id=2555 my $GIF = $ENV{MY_GIF} || "C:\\Perl\\tk\\prog2\\matx.gif"; my %MATRIX = (hip => ",\n", space => "\n"x14, onegap => " \n"); $MATRIX{$_} = "$_\n" for qw/a b c d e f g H i j k l n o r s w y/; my $ITERATIONS = $ENV{MY_ITERATIONS} || 0; my $main = MainWindow->new(-title => "Matrix...", -bg => $BG_COLOUR); $main->minsize(qw(422 200)); $main->maxsize(qw(422 200)); $main->idletasks; # necessary ! $main->iconimage($main->Photo(-file => $GIF)); $main->Frame(-bg => $BG_COLOUR)->pack(-side => 'left', -fill => 'y'); # -------------------------------------------------------------------- +-- package MatrixBoxes; sub new { my @m; for (1..3) { push @m, $main->Text(-width => "2", -background => $BG_COLOUR, -font => $FONT, -foreground => "lightgreen", -wrap => "none", -relief => 'flat')->pack(-side => 'right', -fill => 'y'); } bless \@m; } sub Contents { my $m = shift; for (@$m) { $_->Contents(@{+shift}) } } sub configure { my $m = shift; for (@$m) { $_->configure(@_) } } sub yscroll { my $m = shift; for (@$m) { $_->yviewScroll(shift, 'units +') } } # -------------------------------------------------------------------- +-- package main; my $m = MatrixBoxes->new; sub five{ my @let1 = @MATRIX{qw/d l r o w onegap o l l e H space/}; my @let2 = @MATRIX{qw/n i a g a onegap o l l e H space/}; my @let3 = @MATRIX{qw/onegap onegap onegap y o b onegap d a b onegap + onegap onegap onegap onegap space/}; $m->Contents(\@let1, \@let2, \@let3); $m->configure(-state => 'disabled'); $m->yscroll(37, 67, 27); for (1..27) { $m->yscroll(-1, -2, -1); $main->update; Time::HiRes::sleep(0.1); } } five for 0..$ITERATIONS; MainLoop;

In reply to Re: Matrix falling text effect by ayrnieu
in thread Matrix falling text effect by Anonymous Monk

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.