use Time::HiRes 'usleep'; # to get usleep ++$|; # same as $| = 1, i.e. enabling autoflush $s='rekcah lreP rehtona tsuJ'; # "Just another Perl hacker", reversed @v=(65..90,97..122,32); # ASCII values for A-Z, a-z and a whitespace do{ do{ # setting $_ to a random letter from @v, printing it print $_ = sprintf '%c',$v[rand@v]; # sleeping for a while usleep 2000; # printing \b, a backspace print"\b" #..while $_ is not the last letter of $s } while $_ ne substr $s,-1; # shortening $s by one, i.e. moving on to the next letter chop $s; # printing $_, i.e. the correct letter for that space print #..while there's still something to print in $s } while $s