"use warnings" or "-w"

Discussion in 'Perl Misc' started by Rohan Romanus Almeida, Aug 14, 2003.

  1. Hi,

    Wanted a little help regarding "use warnings".

    AFAIK, there are the following choices:

    1) #!/usr/bin/perl -w

    In this mode, the perl interpreter is started with "-w",
    as a command line option.
    But if the user knows the absolute path of the perl script,
    then he can execute,
    $ perl /path/to/perlscript

    So, does he bypass the "-w" option?

    2) #!/usr/bin/perl
    use warnings;

    I think this is the bestest choice!


    I normally begin my perl scripts with the following 2 lines:

    #!/usr/bin/perl
    use strict; use warnings;

    Is this safe?
    What do most of you people use?

    Thankz.

    --
    arc_of_descent
    Rohan Romanus Almeida, Aug 14, 2003
    #1
    1. Advertising

  2. Rohan Romanus Almeida

    Sam Holden Guest

    On Thu, 14 Aug 2003 18:37:14 +0530,
    Rohan Romanus Almeida <> wrote:
    >
    > Hi,
    >
    > Wanted a little help regarding "use warnings".
    >
    > AFAIK, there are the following choices:
    >
    > 1) #!/usr/bin/perl -w
    >
    > In this mode, the perl interpreter is started with "-w",
    > as a command line option.
    > But if the user knows the absolute path of the perl script,
    > then he can execute,
    > $ perl /path/to/perlscript
    >
    > So, does he bypass the "-w" option?


    No.

    Of course you could have tried it youself and known the answer without
    asking...

    --
    Sam Holden
    Sam Holden, Aug 14, 2003
    #2
    1. Advertising

  3. Rohan Romanus Almeida <> wrote:

    > 1) #!/usr/bin/perl -w
    >
    > In this mode, the perl interpreter is started with "-w",
    > as a command line option.
    > But if the user knows the absolute path of the perl script,
    > then he can execute,
    > $ perl /path/to/perlscript
    >
    > So, does he bypass the "-w" option?



    What happened when you tried it?


    > 2) #!/usr/bin/perl
    > use warnings;
    >
    > I think this is the bestest choice!



    <aol> Me too! </aol> But not because of how the program is invoked.

    It is because lexical warnings are better than global warnings.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Aug 14, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ted Sung
    Replies:
    1
    Views:
    299
    Sherm Pendley
    Aug 30, 2004
  2. Marius Gavrilescu

    Re: use strict; use warnings;

    Marius Gavrilescu, Feb 24, 2014, in forum: Perl Misc
    Replies:
    152
    Views:
    459
    $Bill
    Mar 11, 2014
  3. Kaz Kylheku

    Re: use strict; use warnings;

    Kaz Kylheku, Feb 24, 2014, in forum: Perl Misc
    Replies:
    0
    Views:
    57
    Kaz Kylheku
    Feb 24, 2014
  4. George Mpouras

    Re: use strict; use warnings;

    George Mpouras, Feb 24, 2014, in forum: Perl Misc
    Replies:
    0
    Views:
    47
    George Mpouras
    Feb 24, 2014
  5. Mart van de Wege

    Re: use strict; use warnings;

    Mart van de Wege, Feb 24, 2014, in forum: Perl Misc
    Replies:
    1
    Views:
    46
    Mart van de Wege
    Feb 25, 2014
Loading...

Share This Page