in reply to Buffering issue with \r (backslash r)?

You ask Perl to read a line and you're complaining that it doesn't return before a line is received.

Perhaps you should change the definition of a line by modifying $/ to "\r".

Or maybe you want to use sysread instead of <> since sysread returns data as it arrives, even if fewer than the amount requested arrive.

Replies are listed 'Best First'.
Re^2: Buffering issue with \r (backslash r)?
by mebbert (Initiate) on Oct 27, 2009 at 13:51 UTC
    Ahhh...I always overlook basic principles. So <> reads lines by definition. Thank you very much.

      Out of curiosity, I'd like to know what you thought it did.

      <> is either a shortcut for readline or glob depending on how its used.

        I forgot that <> reads lines (or more accurately, readline or glob, as you pointed out). Rather, I thought it would just read the input as it came. And since I set autoflush for STDOUT, I expected to get it in real time.

        Thanks again!