A possibility is redrawing the whole screen at each frame. For instance (only tested on linux):
#!/usr/bin/perl -w
# Array containing all lines
my @screen = ( ' 'x70 . "\n" ) x 20;
# Array of possible (equiprobable) characters
my @char = split //, ' *|';
while(1) {
print join '', @screen;
# Drop last line
pop @screen;
# Put a new line on top
unshift @screen, join ( '', map { $char[ rand(@char) ] } (1..70) )
+ . "\n";
# Sleep for 0.1 seconds
select(undef, undef, undef, 0.1);
}
Update: The value 20 in the @screen initialization should be at least the terminal height minus 1 (due to the last line being empty). If it's less, then the upper portion of each frame is filled by the last lines of the previous one.
Cheers
Antonio
The stupider the astronaut, the easier it is to win the trip to Vega - A. Tucket