Click to See Complete Forum and Search --> : Total newbie question


Sibo
06-11-2001, 10:02 PM
I'm starting to learn perl, but since this is the first time I've programmed outside of Windows (I've done C++, javascript, java, etc.), I need some really basic help.

I have in my hands a copy of Learning Perl. One of its first examples of a perl program is:

#!/usr/bin/perl -w
print "Hello, World!\n";

Okay, so I type this up in a word processor. And I save it to the filename "hello"

Now, how do I run this program? Please give a short reply; I know this question is simple, all I need is this knowledge and I can probably teach myself the rest of Perl.

Thanks

dchidelf
06-11-2001, 10:33 PM
The file needs to be executable...
You can set the permissions to be executable by you with:
chmod u+x hello

then you should be able to execute it with
./hello
from within the directory containing the file

hope that helps

Chad

[GoRN]
06-11-2001, 11:01 PM
you could also type:
perl hello
perl < hello
cat hello | perl
all of those will work, but the chmod and ./ is prolly the best