How can I stop my Perl program from closing the window after finishing execution in windows?
I can run a Hello World Program, but it closes way too quick for me to actually read it.
print "Hello World\n";
while (1){sleep(1)}
Seems to be the only solution I could find, but I'm betting there is a better way to do this.
Run your script from the Windows command prompt, instead of clicking on an icon in Explorer. When you run console mode programs from clicking on an icon, Windows will open a window for the program, run it, then close the window. When you run console mode programs from a command prompt, the window won't close:
C:\test> perl hello.pl Hello World C:\test>
print "Hello, world\n";
print "Press RETURN to continue ";
<STDIN>;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With