in reply to Re^4: Is there a way to halt the program until an enter is pressed?
in thread Is there a way to halt the program until an enter is pressed?

You may be Suffering from buffering. Try setting the $| special variable to 1 (see perlvar).

True laziness is hard work
  • Comment on Re^5: Is there a way to halt the program until an enter is pressed?

Replies are listed 'Best First'.
Re^6: Is there a way to halt the program until an enter is pressed?
by Anonymous Monk on Mar 14, 2011 at 00:47 UTC

    Can you advise where should I set $| to 1,right before the print statement?

      I can, but I'm disinclined to acquiesce to your request. Go read the documentation I pointed you at or try it out in a test script (or both). Either way you'd have an answer before you received this reply.

      True laziness is hard work

        If I do a test script,the script looks fine,it waits after the print statement,confused :-(

        use strict; use warnings; print "\nTest1\n"; print "\nTest2\n"; print "Press <Enter> to continue, or 'q' to quit: "; my $user_input = <STDIN>; exit if $user_input eq "q\n";