This is a pretty common problem when you are first starting. The *best* way to deal with this to open up a DOS prompt and cd \path\to\script. Then, you can run the script from the command line and the window won't close.
You could use something like getch() to make the window pause before closing, but it's an ugly hack (IMHO). Working from the command line is cleaner.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
| [reply] |
Or you could open a DOS prompt, cd into the dir of your script, and do:
perl script.pl > output.txt
Then you could just take a look at output.txt @:)
----------------------------------
away: Constructing a sound defense | [reply] |
I tend to throw in a <>; at the end of my script, this will require an Enter keypress at the end to close the window.
He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
Chady | http://chady.net/
| [reply] [d/l] |
You need to simply open the MS-DOS command prompt, and run the program from there. For example, if I had a program located in C:\MyPerlScripts, I would type the following at the prompt:
C:\>cd MyPerlScripts
C:\MyPerlScripts>perl script.pl
Any output of the program would go to STDOUT. I am assuming that you are merely clicking on the icon for the program, which would run it, but any output would simply display quickly, then disappear when the program exits, as the command shell created when the program runs, would exit.
TStanley
--------
"Suppose you were an idiot... And suppose you were a member of Congress... But I repeat myself." -- Mark Twain
| [reply] [d/l] |
You can download a text editor that will call perl to run your program for you, and will then capture its output and display it alongside. This is comforting if you're used to having an IDE to work with. I'm new to perl, and I'm using UltraEdit, which I found on the outside links page on this site. (Update: I messed up the link, but now it works. b] (Update: thanks to Yves/DeMerphq for his improved UltraEdit Wordfile.) | [reply] |
You can always sneak in a system("pause") which I find handy sometimes...
gav^ | [reply] [d/l] |
There are a number of options:
- Launch a 'console' (MS-DOS window) by going to Start->Run and typing in either command.com or cmd (dependent on your Windows version). Then just type
cd /path/to/perl/script perl scriptname.pl and it'll execute in the window.
- Get an application such as Editplus or Ultraedit allow you to run Perl scripts in a window.
- Add <>; at the end of your script. You'll then have to press Enter to exit out of it
| [reply] [d/l] [select] |