By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,708 Members | 2,055 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,708 IT Pros & Developers. It's quick & easy.

How to display program output on vista machine

P: 1
Hi,

I am very new at PERL program as i am writing my first program.
Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/perl -w
  2. print "hello world!\n";
  3.  
but the output window is disapearing very quickly that i cant even really see anythin on the window. I dont even know that if this programming is really working. by the way, i am using windows vista.

anyone would u plz help me with that? i really aprreaciate that.

thank u
Mar 30 '10 #1
Share this Question
Share on Google+
1 Reply


numberwhun
Expert Mod 2.5K+
P: 3,503
First, the first line in the script is the "shebang" line. Specifically, I am referring to this line:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/perl -w
  2.  
The -w in the line tells perl to turn on warnings. I personally don't use the switch, I just specify it without it. On another note about it, that line is specific to a Unix/Linux system. Since you are on Windows, you don't really even need that line, but its good practice to stay in. You could specify your c:\ path to the perl interpreter if you wish. When I develop on Windows (if ever), I don't put it at all.

When starting a perl script, your script should always start as follows, using a unix example:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/local/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
You will find that a number of us on here will have you add those two lines after the shebang line and troubleshoot the issues it finds before we will look at your code.

The reason the window goes away so quickly is because the program exits that quickly. My recommendation is to run your scripts from the command line instead of double clicking on them. It will allow you to see all that is going on. Open the dos prompt, navigate to where the script is and run it as so:

Expand|Select|Wrap|Line Numbers
  1. perl script.pl
  2.  
You will notice that the script runs and outputs to the screen and goes back to a prompt.

Hope that helped.

Regards,

Jeff
Mar 30 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.