Perl "Shebang"

B

Bill H

Can anyone tell me what the "--" means in this line:

#!/usr/bin/perl --

This is part of a forum script (YaBB). I haven't see just -- before

Bill H
 
A

A. Sinan Unur

Can anyone tell me what the "--" means in this line:

#!/usr/bin/perl --

This is part of a forum script (YaBB). I haven't see just -- before

C:\Temp> perl -h

Usage: C:\opt\Perl\bin\perl.exe [switches] [--] [programfile] [arguments]

Clearly, it marks the end of command line switches.

My guess is, YaBB authors used it to protect against accidental binary FTP
transfers between Windows and Unix EOL based systems mucking up the shebang
line.

Sinan
 
J

Josef Moellers

Bill said:
Can anyone tell me what the "--" means in this line:

#!/usr/bin/perl --

This is part of a forum script (YaBB). I haven't see just -- before

Usually '--' on a command line means that anything after that will *not*
be considered an option, even if it begins with '-'.

I don't know YaBB and how it calls the script, but I guess that the
script might be called with additional parameters which may be provided
by the user, and this construct prevents the unwanted interpretation of
a leading '-' in the first argument.
 
J

John W. Krahn

Bill said:
Can anyone tell me what the "--" means in this line:

#!/usr/bin/perl --

This is part of a forum script (YaBB). I haven't see just -- before

On the command line it means that there are no more program switches
(options) to the right of --, everything following -- is data only.

In a program like that it is used as a guard against extraneous
whitespace confusing the operating system. For example, if you edit the
script in Windows and then try to run it in *nix.


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,206
Messages
2,571,069
Members
47,677
Latest member
MoisesKoeh

Latest Threads

Top