Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Letter by letter

by DaveMonk (Acolyte)
on Apr 20, 2012 at 18:33 UTC ( #966231=note: print w/ replies, xml ) Need Help??


in reply to Re: Letter by letter
in thread Letter by letter

Hmm... it prints out the string directly. I want it to instead of print "string", to make it so it has 1 second intervals between each character it's printing... But im going to read the article you linked me.


Comment on Re^2: Letter by letter
Re^3: Letter by letter
by Riales (Hermit) on Apr 20, 2012 at 18:41 UTC

    Ah, in that case, I think you were mostly on the right track except with the buffering thing and the end case for the for loop.

    $| = 1; foreach my $letter (split '', $string) { print $letter; sleep 1; }

      Somewhat obscure, but I think the following is cute:

      sleep($|=print) for split '', $string;

      print returns 1 if it's successful.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://966231]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-09-30 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (368 votes), past polls