in reply to Re^4: Perl logical operators
in thread Perl logical operators

Perl5opt is already provided for that explicit purpose. PERL5STRICT is dumb.

Replies are listed 'Best First'.
Re^6: Perl logical operators
by roboticus (Chancellor) on Jul 19, 2018 at 15:55 UTC

    Nice! I really ought to review all the perl docs again and see what other interesting things I've missed.

    I just gave it a try, and it seems to work well. I went ahead and updated my .bashrc file:

    . . . export PERL5LIB="/mystuff/Perl/LIB" export PERL5OPT="-Mstrict -Mwarnings" alias p5="perl -Mstrict -Mwarnings" . . .

    and now have the behavior I want. Pretty nice.

    The PERL5OPT setting might interfere with some other scripts (I won't know until I run into one of them), so I created an alias to do essentially the same thing. (I wonder why I haven't thought of that earlier?) I'll remove the PERL5OPT setting if/when it causes me any grief. As Your Mother mentions earlier, it's often going to be a problem for one-liners. I rarely use one-liners, but I don't know how many are embedded into many of the tools I use.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Note that strict and warnings are lexical pragmas. It will only apply to the code or file you execute directly, not any included modules. This is a good thing; you don't want to have to fix bugs you introduced to code you didn't write. (This is also why -w and -W are the wrong approach.)