#!/usr/bin/perl use warnings; use strict; $|= 1; # This is usefull and required only on win32 machines eval{require Win32::Console::ANSI;}; # number of JAPHs per graph my $counter; # define the parameters for the graph my ($u,$v); # a way to slow the counter decrease, see below my ($a,$b); while(1) { unless ($counter) { # choose a random color printf("\e[1;%dm", 30+rand(7)); # clear the screen printf("\e[%d;%dH%s",1,1,"\e[J"); $u = rand 39/999; $v = rand 39/999; $counter = 3999; $b=qw/19 9 1/[int rand 3]; }; # print J A P H, on the given position printf ( # the ansi code mask "\e[%d;%dH%s", # X 11*sin($v*$counter) + 13, # Y 39* cos($u*$counter) + 41, # one of the four letters qw/J A P H/[$counter%4] ); # here is how $a and $b are used. ($a++%$b) or $counter--; }