I installed the perl plugin in IntelliJ IDEA 2016.1.3, but the next program doesn’t print anything immediately waiting for input, and only when you do it, it displays everything at once. Here is the code:

#!/usr/bin/perl print "Hello, what is you name?\n"; $s = <>; print 'Hello' . $s;

Thank you in advance for your help

  • Yes, if you run from cmd, then everything works fine. - Eugene
  • Somewhere here already there was a question in which they complained about the similar, only for the plus code and then they determined that it was just a bug inside the IDE. - KoVadim
  • Try to add a line before print $|=1 ; I don’t know if it will help or not, but it forces you to reset the output stream with each print. - Mike
  • Thank you very much! It seems to work. - Eugene
  • @Mike well, it should work well without $| . - edem

1 answer 1

As a result of the correspondence in the comments, it became clear that the IDE had a problem with flushing buffers. For good, before entering anything into STDIN, all console output in STDOUT should be reset. In this case, this does not happen.

To force a reset of the I / O buffers after each print operation, it must be enabled at the beginning of the program:

 $|=1;