Hello all.
I am new to PERL. I have question about this line:
#!/usr/local/bin/perl
Does all perl source files must be with that same line (path to compiler of perl)? What if path in other host is not the same as in others? I know that this line tells to run the file through Perl.
Your file doesn't need or require it, so you can leave it out. What it does is to tell where the Perl-interpreter is located, so that you can run the script with a double-click or similar.
So I can write PERL scripts without these lines? And it will work?
If you do not include it you will not be able to execute the Perl script with "./scriptname.pl" and will have to call it as "perl scriptname.pl". It will also not work via the web executed from Apache/your webserver software.
But what if I move script to other server where value of this first line
#!/usr/local/bin/perl
will be other? I will must replace these lines by hand or what?
Yes. Or you could create a symbolic link in /usr/local/bin/ to the new location of Perl (only in Linux).
Big thanks Jordan. What is symbolic link? Its made by .htaccess:
Options FollowSymlinks
or what?
It is done at the operating system with the command: "ln -s /path/to/link".
Ok, thanks Jordan for answers.
Easier to just edit the shebang line than changing the server configuration, unless you are the server administrator that is.
Apache can also be setup to not use the shebang line, but again, this is a server configuration and you may not be able to edit the apache config file or restart the apache server.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks