#!/usr/bin/perl -w

my $figlet = "/usr/bin/figlet";
my $font = "figletfont/doh";
my $text = "foo bar baz";
my $figtext = qx($figlet -f $font $text);
$| = 1;
my @figarray = ();
my ( $x, $y, $xmax, $ymax ) = ( 0, 0, 0, 0 );

foreach my $line ( split( "\n", $figtext ) ) {
    foreach my $char ( split( "", $line ) ) {
	$figarray[$y]->[$x] = $char;
	$xmax = $x if ( $x > $xmax );
	$x++;
    }
    $x = 0;
    $ymax = $y if ( $y > $ymax );
    $y++;
}

for( $y = 0; $y <= $#figarray; $y++ ) {
    for( $x = 0; $x <= $#{ $figarray[$y] }; $x++ ) {
	print $figarray[$y]->[$x];
       	select( undef, undef, undef, 0.01 );
    }
    print "\n";
}
