Consider:
So the practice does prevent one problem. Not one you are likely to run into, but a problem still.$ mkdir ./-e $ cat >./-e/test #!/usr/bin/perl -w die "It ran!"; __END__ $ chmod a+x ./-e/test $ ./-e/test It ran! at ./-e/test line 2. $ -e/test Search pattern not terminated at -e line 1. $
For that last command, perl gets executed with a command line that looks like:
(at least on some operating system / shell combinations) and it doesn't know that "-e/test" is the name of a script file instead of the "-e" option asking it to interpret the code "/test" (which causes it to complain about not finding the terminating "/" for that pattern match).perl -w -e/test
I could envision some operating systems filling in the "--" for you such that including your own "--" would cause perl to report:
though. So I'm not sure what to advocate at this point. - tyeCan't open perl script "--": No such file or directory
In reply to Re: Using -- to terminate switch processing (good point)
by tye
in thread Using -- to terminate switch processing
by thelenm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |