#!/usr/bin/perl -w
print ("5 beer, please.\n");
$drink = "whisky";
$howmany = 1;
$howmany = $howmany + 1;
print ("Or $howmany $drink, please.\n");
exit;
$ chmod +x hw.pl $ ls -l -rwxr-xr-x 1 ntakebay ntakebay 45 Apr 9 20:00 hw.plRemember the unix permissions? To run a script, the file has to be executable (x). If you use minus sign (chmod -x hw.pl), the executable bit get unset.
| chmod u+w file | (u)ser who owns it can write |
| chmod o+r file | (o)ther people can read |
| chmod ugo-wx file | (u)ser, (g)roup, and (o)thers cannot write or execute |
| chmod -wx file | same as above |
#! tells that the script should be
``interpreted'' by a ``perl interpreter'' program /usr/bin/perl.
If the perl interpreter program perl is not at this location,
it might be installed in /usr/local/bin/perl. Then the first
line should be ``#!/usr/local/bin/perl''.
To find the location of the perl interpreter, try
which perl