oneoleguy

The Perl Shebang Line

1 post in this topic

Hi everyone,I am starting to learn Perl and have had a little difficulty. The start of my problem was the Shebang line.It's the first line of a Perl program and starts out with #!. The # indicates a comment, but the following ! turns it into a perl directive. It is followed by /usr/bin/perl .The line would look like:

#!/usr/bin/perl

Great, this is fine! It will work in Perl in MS/DOS windows, PerlMac, raw Unix (and Linux) and Apache servers on Unix (and Linux)However, when you run it on Apache on your own PC, you may have to change this line.I have Apache2Triad installed on my PC. The correct Shebang line for it is:

#!C:/apache2triad/perl/bin/perl.exe

This path to Perl is listed in the apache2triad Control Program, on the lower left of the screen. If you're just starting out with perl and your programs aren't working, check this line out, for "your server" first!Bill

PS I have a 1999 copy of SAMS Teach Yourself Perl and it mentions that you may already have Perl installed on your PC. You may not need to install it. Get to a DOS prompt and type "Perl -v". If you get a PROGRAM NOT FOUND message, then it isn't installed. Get to a command prompt for unix and linux and type "perl -v" PerlMac is a little different - check your documentation.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now