in reply to Problem with Perl editors.

It's not them, it's you. You are Suffering from Buffering.

In short, the following code near the top of your script will likely solve your problem:

use strict; $|++;

Replies are listed 'Best First'.
Re^2: Problem with Perl editors.
by radiantmatrix (Parson) on Jul 05, 2005 at 16:13 UTC
    I would suggest $|=1; instead, just because it's a good habit. I've seen moronic situations where $| gets set to -1 (by a previous mistake by another coder) and thus the $|++ I put in place didn't exactly have the desired effect. ;-)

    Much better, IMO, to explicitly say what you mean.

    Larry Wall is Yoda: there is no try{}
    The Code that can be seen is not the true Code

      Are you sure?

      perl -e "$| = -1; print $|"

      $| is magical in that it can only have the values 1 and 0. $|++ switches unbuffering on, while $|-- toggles from on to off and back to on.

        Hm, this works on my current Perl installation, but I remember running into the problem as I explained it. Odd; I wonder if it was an old Perl, or something custom on that system...

        Larry Wall is Yoda: there is no try{}
        The Code that can be seen is not the true Code

        I echo radiantmatrix's comment: better to explicitly say what you mean.

        Where alternate 1 does the job, but offers no significant performance advantage, is not significantly shorter and is obscure (to any degree), then alternate 2 which is explicit is always better (unless of course you are writing deliberatly obscure code).


        Perl is Huffman encoded by design.
      I've seen moronic situations where $| gets set to -1
      Huh?!? I would be curious to know how to do so, since AFAIK it is not actually possible:
      $ perl -le 'print $|=-1' 1

        You may wish to read my response to Corion. I recall an app where $|-- was called twice, and when I printed the value of $| while debugging, I showed '-1' as its value. This was a long time ago, and perhaps was something unique about the environment -- I had assumed all this time that it was normal Perl behavior, but it appears I'm wrong.

        Larry Wall is Yoda: there is no try{}
        The Code that can be seen is not the true Code
Re^2: Problem with Perl editors.
by techcode (Hermit) on Jul 05, 2005 at 15:29 UTC
    Right buffering ... havent tougth of that :)

    Then it's strange why it's working in Komodo as espected ...