Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Letter by letter

by Riales (Hermit)
on Apr 20, 2012 at 18:41 UTC ( #966234=note: print w/replies, xml ) Need Help??


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

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; }

Replies are listed 'Best First'.
Re^4: Letter by letter
by tobyink (Abbot) on Apr 20, 2012 at 23:14 UTC

    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://966234]
help
Chatterbox?
[TStanley]: talexb I was actually in your area last week. I was working in Milton, Ontario at the hospital they are building there.
Eily hasn't entered monk school
[Eily]: there are some special array variables that are not interpolated in double strings, like @*, @/, @(, and @)
[Eily]: is this documented somwhere?
[Eily]: "@{/}" does interpolate @/ though
[Eily]: (while the same for @*, @(, and @) throw a warning)

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-06-23 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (547 votes). Check out past polls.