dhannotte has asked for the wisdom of the Perl Monks concerning the following question:

Under 5.6, when I sent a carriage return to the command line using

    print("\r");

it positioned the cursor back at the beginning of the line. Thus I could show a changing value on one line of output, usually by doing something like

    print"\rJob %2d% completed.", pc);

By issuing this message once a second I could always see the status of my job, wasting very few processing cycles. As of 5.8, however, nothing appears until I print a newline by

    print("\n");

Have the i/o semantics changed? Is there a work-around for this?

Thanks very much!

Replies are listed 'Best First'.
Re: Carriage return handling difference between 5.6 and 5.8
by graff (Chancellor) on Aug 10, 2008 at 23:01 UTC
    Have you tried turning off buffering?
    $| = 1;
    I'm not sure if it's really a difference between 5.6 and 5.8 -- I suspect there may be something else in your environment or usage for your script(s) that is causing the difference in behavior.
Re: Carriage return handling difference between 5.6 and 5.8
by Lawliet (Curate) on Aug 10, 2008 at 23:03 UTC

      Wow, I was indeed SUFFERING

      from BUFFERING!

      From now on I'll make up a RHYME

      And save a lot of TIME.

      (Very helpful, guys. Thanks a bunch!)

        You'll get used to the methods we use;

        From now 'till then, do more than peruse

        ;P

        chomp; # nom nom nom