in reply to print statement does not work

Well, if it's a file containing a perl script, on a solaris box, then the first line of the file should read:
#!/usr/bin/perl
or whatever the path is to the perl interpreter (binary executable) file that you have installed.

If the installation went well enough for the perl interpreter to run, then the following shell command ought to work, printing the config/environment info for your installation:

perl -V
and so should the next command line, printing "hello, world" on your screen, assuming that your newly installed perl can be found in the PATH variable of your current environment setup.:
perl -e 'print "hello world\n"'
(note the use of both single and double quotes)

What seems odd is that you have to install perl yourself on a solaris box -- I would have thought that perl would be there already. Anyway, if you've done your own perl install for whatever reason, you have to know the path to your "perl" executable, and you have to make sure you cite that path on the shebang line of every script you write.

Replies are listed 'Best First'.
Re: Re: print statement does not work
by Hammy (Scribe) on Dec 17, 2002 at 02:47 UTC
    Thank you, your help is appreciated. The command line perl statement works well (as did the perl -v). When putting the /usr/local/bin/perl in the first line, I get an internal error as if it does not know where it is. Is there a way to check where it thinks perl exists.
      Folks here might be able to help if you:
      • Post the code you're trying to run
      • Post the error message or other odd result you're getting

      The information you've provided so far is too vague.

      By the way, what do you get in response to either of these two commands:

      type perl which perl
      Those should print the path where your shell finds the perl executable, given your current PATH setting. That is what should be on the shebang line of any perl script you write. (Note: this could report the path to a version of perl that you did not install yourself. You do know the path to the version you installed, right? Did you actually place your installation in /usr/local/bin?)
        The code I am trying to run is trivial:
        #!/bin/perl print "Content-type: text/html\n\n"; print "hi";
        When typing both type and which perl, I get /bin/perl. I changed the code to now use that path and I still get the error message :
        The server encountered an internal error or misconfiguration and was unable to complete your request.

        Please contact the server administrator, webmaster@thed87.tempdomainna +me.com and inform them of the time the error occurred, and anything y +ou might have done that may have caused the error.
        More information about this error may be available in the server error log.

        Unfortunately there is no webmaster - I'm it. I have a huge site that I am porting from FreeBSD to Solaris and I am just trying to get a simple program to run.

        I have had absolutely no experience installing or manipulating perl. The FreeBSD environment was a managed hosting environment where everything was standard and maintained by the host.

        update (broquaint): removed <br>s in <code> tags and put <code> tags around the error message