Jump to content

Correct Path To Perl


Recommended Posts

Hello;

 

I want to be sure on writing the perl address, I did ask this before and I got

the right answer, now in the code page of perl that I have, there is already a perl address,

here it is:

#!/usr/bin/perl

 

I have got the perl address before and it is:

/usr/bin/perl

 

there are two signs in the beginning

which make me confused:

 

 

If you know perl, I appreciate your help,

 

should I remove those signs or not?

 

 

Thank You for your help

Link to post
Share on other sites

The first line is the correct way to include the path to perl in your scripts.

 

#!/usr/bin/perl

 

The #! is called a shebang. This line instructs the operating system the Perl script is being ran in where the executable for Perl and all of its associated files are located. This line is commonly only required in Linux and UNIX variants, users running Perl in Microsoft Windows do not need this line.

Link to post
Share on other sites

Hi,

 

I'll add that Bruce is right on and this difference between Linux and Widows will often create havoc in testing enviroments if you are testing in a Windows environment and running production on Linux. Some Perl versions of Windows will not run with the #! in the beginning.

 

Thus a windows programmer can get very frustrated when he has tested his code, uploaded it, and then it doesn't work just because of a simple #!.

 

Not fun! :(

 

Keep your eye out! :)

 

Take care,

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.

Guest
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...