Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

-s is for one-liners (and even then isn't very useful). -Mstrict is not for one-liners. The two are pretty much completely incompatible. However, you could just write:

#!/usr/bin/perl -ws use strict; # My supported command-line switches: use vars qw( $switch $help $debug $foo ); $switch= "hooray" unless $switch;
I see no reason to have a global $switch that Perl creates and then have a different, same-named lexical that you create with my.

Note that anyone using your script can accidentally type

minus-ess -snitch -helf -debung -food
and your program will silently act just like they hadn't included any command-line switches (that is, unless your program also defines a global named, for example, $food, and then relies on it to be initially uninitialized).

In other words, I don't consider this even close to a good design decision. ):

        - tye (but my friends call me "Tye")

In reply to (tye)Re: Using perl's runtime options with -Mstrict by tye
in thread Using perl's runtime options with -Mstrict by deprecated

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2021-12-06 18:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (33 votes). Check out past polls.

    Notices?