[Courses] [Perl] Part 1: Getting Started

Fazia Begum Rizvi fazia at faziarizvi.net
Tue Apr 5 14:15:31 EST 2005


On Tue, 5 Apr 2005, Devdas Bhagat wrote:

> On Unix systems, the OS needs to be told that the file is an executable.
> You can do this by running chmod +x file. Refer to the chmod manual for
> more detail on the options it takes. man 1 chmod.

Yeah - that much I knew, and the chmod command works fine on OSX. (I was 
able to make it executable.) Still didn't work though, so I was stumped. 
(Not that it matters too much since I'll be doing everything else on an 
Linux server, but I was curious.)


> Also, on most Unix systems, the current directory is not in your PATH
> environment variable. The PATH is the list of directories where an
> executable is looked for by the shell. To see your current PATH,
> echo $PATH in your shell. If you had marked that file as executable,
> then you should try running ./hello.pl to see if it works.


Ah! Okay, lemme see if that works...


>> #!/usr/bin/perl -w
>> use strict;
>> # My very first perl program April 4, 2005 - Fazia
>> my $who;                        # Declare variable
>> $who = "world";                 # Assign variable
>> print "Hello, world!\n";        # Print result
>>
> Did you mean to use $who up there?
> print "Hello, $who!\n";

Yup, but I copied and pasted before I fixed that. :-)

Thanks!

-Faz



More information about the Courses mailing list