CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
starting trouble

 



amitashr
New User

May 30, 2008, 6:36 AM

Post #1 of 5 (976 views)
starting trouble Can't Post

HI im new here and new to perl programming....i installed activeperl on windows vista and tried to run my first program exactly as an ebook told me to
print ("hello wold\n);


now wen i save and try to run this the output screen just flashes for a second and disappearsMad bfore i can even take a look at the window...im totally new to perl and all the programming i have done is basic C...any help would be appreciated thank u...



winfinit
User

May 30, 2008, 11:08 AM

Post #2 of 5 (966 views)
Re: [amitashr] starting trouble [In reply to] Can't Post

you need to run a program from your terminal, if you are executing your file just by clicking on icon of the source code it will execute it, and once program is done it will terminate itself and window/shell. so if you would go to your command prompt and find your file and then type "perl nameOfYourFile.pl" that will execute your script, and you will stay inside your shell. you can also do something silly like sleep action after your hello world thing, so if you execute it same way as you did before, program will not terminate right away.

#!/usr/bin/perl
print "Hello\n";
sleep(20);

that will leave your script running for extra 20 seconds.

good luck with learning :) Perl is amazing language!


KevinR
Veteran


May 30, 2008, 12:11 PM

Post #3 of 5 (961 views)
Re: [amitashr] starting trouble [In reply to] Can't Post

Hopefully this is not what the book says to do:

print ("hello wold\n);

The first problem is that it is not valid pel code, unmatched qutoation marks, the second problem is that wrapping the argument to print commands in parenthesis is rarely ever needed and can lead to problems later on if you are unaware of how the print command works.

What ebook are you using?
-------------------------------------------------


KevinR
Veteran


May 30, 2008, 12:14 PM

Post #4 of 5 (960 views)
Re: [winfinit] starting trouble [In reply to] Can't Post

winfinit,

activeperl on Windows does not use the shebang line, and the one you posted is not for a windows environment anyway. I am sure that you put that shebang line in out of habit, but I mention it just in case.
-------------------------------------------------


amitashr
New User

May 31, 2008, 4:16 AM

Post #5 of 5 (953 views)
Re: [KevinR] starting trouble [In reply to] Can't Post

thanx for ur help...i ran i through the command prompt and it worked perfectly...and i didn post my code properly...it is:


Code
  

print("hello world");



and im using the ebook "learning perl on win32 systems" by O'reilley

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives