[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] print chars to STDOUT without \n?



At 12.07 97/2/18, alex dosher wrote:
>i want to print one char at a time to STDOUT, but print doesn't flush the
>buffer until it hits a \n.  i seem to vaguely remember that this is
>possible, but i can't figure it out; printf "%c" doesn't work (at all - i
>get a "Argument isn't numeric in prtf" error) - any ideas?

#!perl
$|=1; #flush print
$x = "This text is cooooooool.";
@x = split (//,$x);
foreach (@x) {print;sleep(1);}


NOTE: this is a general Perl question, not exclusive to MacPerl by any means.

Hope this helps,

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6