Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Using -- to terminate switch processing

by Kanji (Parson)
on Mar 26, 2003 at 18:28 UTC ( [id://246033]=note: print w/replies, xml ) Need Help??


in reply to Re: Using -- to terminate switch processing
in thread Using -- to terminate switch processing

What (potential) errors does the addition of the '--' prevent?

On systems that do depend on the shebang to find the executable, a stray carriage return (as so often happens when transferring files from Windows to Unix) can break that magic. Adding -- in such cases ensures that the trailing ^M never interferes with the binary name. Then again, adding ANY switch seems to accomplishes the same...

$ cat -e cM.pl #!/usr/bin/perl^M$ ^M$ print "Hello, World!";^M$ $ ./cM.pl : bad interpreter: No such file or directory $ cat -e cM--.pl #!/usr/bin/perl --^M$ ^M$ print "Hello, World!";^M$ $ ./cM--.pl Hello, World!

    --k.


Replies are listed 'Best First'.
Re:^3 Using -- to terminate switch processing
by bsb (Priest) on Mar 30, 2003 at 05:02 UTC
    I hit this when using -F/pattern/ as the last argument on a shebang line moved to windows. So maybe it makes the script more portable. I'd prefer it if perl could take care of it though.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://246033]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-23 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found