Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

easy perl problem

easy perl problem

easy perl problem


I am just new to perl and would apricate an answer to a simple question.

in looking at perl example code, some programs have the following two line of code at the top of the program.

# change the above code to whereever your perl interpreter is.

Fine, I assume you simply enter the pathway for my intepreter in the top line, but in doing that how do you make it work?

This is in connection with cgi and the creation of cookies.  I think it's meant to be run inside a web browser, but it doesn't work, I'm I missing a reference.

Please help urgently

Thank you

RE: easy perl problem

The #!/usr/bin/perl string implies that you are on a UNIX OS.  In that context...a few

Once you have fixed the top line of the program, try
perl -c yourProgramName.cgi <return>

That will do a syntax check on your code and barf on you if it has problems.  If it does not complain, then your syntax is OK.

Make sure the execute bit(s) are set so the web daemon can run the code.  If you don't understand this, ask and I will elaborate.

Make sure your code is in a directory which your web server recognizes as legal for
executable code. Usually,........./httpd/cgi-bin/someSubDir/   or something like that downstream on the http/cgi-bin path.

Additionally, this is not meant to be insulting ( I don't know everything either) but, the nature of your question indicates a fairly shallow knowledge of PERL and CGI.  Note, those are two completely separate topics.  Try SAMs "teach yourself CGI Programming with Perl 5 in a week".  It is fairly straight forward with enough perl and enough CGI to get you on your feet.  Be aware that playing around in CGI with an insufficient understanding of the security issues can get you  in a bad way.  Security is an issue.

RE: easy perl problem

The #!/usr/bin/perl line on windows can be tricky some web servers need to have it look like that and the folder actually exist on the web ex #!/usr/bin/per/  the folder http://yoursite/usr/bin/perl/ would have to exist.  on the apache web server the first line has to look like this #!c:/perl/bin/perl.exe   not that that is an actuall file path.  and that they are slashes(/) and not back slashes(\).  hope mine or goBoating's reply helps

Karl Pietri

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close