use Time::HiRes qw( sleep); use constant SIZE => 15; my @map = do { my @ones = ( 1) x SIZE; my @mixed = ( 1, ( 0) x (SIZE - 2), 1); ( [ @ones], map( [ @mixed], 1 .. SIZE - 2), [ @ones], ); }; my @positions = ( [ 8, 4], [ 9, 5], [ 10, 6], [10, 7], [10, 8], [ 10, 9]); my $clear_string = `clear`; for my $pos ( @positions, reverse @positions ) { print $clear_string; print image( \ @map, @$pos); sleep 0.2; } exit; sub image { my ( $map, $x, $y) = @_; my @image = map join( '', map $_ ? '* ' : ' ', @$_), @$map; $_ .= "\n" for @image; substr( $image[ $y], 2*$x, 1) = '@'; @image; }