Perl : how to interrupt/resume loop by user hitting a key?
- by Michael Mao
Hi all:
This is for debugging purpose. I've got a for loop that generates some output to Cygwin bash's CLI.
I know that I can redirect outputs to text files and use Perl or even just a normal text editor to inspect the values printed out for a particular iteration, just feel that a bit painful.
What I am now thinking is, to place a special subroutine inside the for loop, so that it would be "interrupted" at the beginning of each iteration, and Perl script should only resume to run after user/programmer hits a key(the Enter Key from keyboard?)
In this way I can directly inspect the values printed out during each iteration.
Is there a simple way to do this, without using additional libraries/CPAN ?
Many thanks to the hints/suggestions in advance.