Jump to content

The Perl Shebang Line

Recommended Posts

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:


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:


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.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...