in reply to perl -s is evil?
Unfortunately, I can't reproduce your results. I get 'password = hello' no matter what, for the following platforms:
- 5.005_03 built for i386-freebsd
- 5.005_03 built for i386-linux
- v5.6.0 built for i386-openbsd
- v5.6.0 built for sun4-solaris
- v5.6.1 built for i386-linux
- v5.6.1 built for MSWin32-x86-multi-thread
update: regarding blakem's one-liner, I see "foo" outputted on all the above platforms. So it looks like a bug. I shall have to revise my opinion regarding -s.
Are you sure that code fragment is what you ran locally? -s isn't that bad. I use it on rare occasions, usually for a short while when a script evolves from needing no command-line switches at all before needing the full-blown mechanism that Getopt::* brings you.
Others may be interested in a tutorial I wrote on the subject a while back: Parsing your script's command line. (Now revised to point to this thread).
--g r i n d e r
In Section
Meditations