How to display program output on vista machine

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kuddin123
    New Member
    • Mar 2010
    • 1

    How to display program output on vista machine

    Hi,

    I am very new at PERL program as i am writing my first program.
    Code:
    #!/usr/local/bin/perl -w
    print "hello world!\n";
    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
    Last edited by numberwhun; Mar 30 '10, 02:50 AM. Reason: Please use CODE TAGS!!!
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    First, the first line in the script is the "shebang" line. Specifically, I am referring to this line:

    Code:
    #!/usr/local/bin/perl -w
    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:

    Code:
    #!/usr/local/bin/perl
    
    use strict;
    use warnings;
    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:

    Code:
    perl script.pl
    You will notice that the script runs and outputs to the screen and goes back to a prompt.

    Hope that helped.

    Regards,

    Jeff

    Comment

    Working...