in reply to Re: use strict without typing use strict?
in thread use strict without typing use strict?

If you wanted to use that all the time, then PERL5OPT is one solution:

$ export PERL5OPT='-Mstrict' $ perl -e '$x = 1; print qq{$x\n}' Global symbol "$x" requires explicit package name at -e line 1. Global symbol "$x" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. $

🦛

Replies are listed 'Best First'.
Re^3: use strict without typing use strict?
by Fletch (Bishop) on May 26, 2021 at 12:53 UTC

    One caveat to keep in the back of your mind if you dabble with PERL5OPT: every arbitrary perl you may run will see that and (try to) honor it. At $work we've got some stuff therein that works fine when run with our separate application copy of a newer version, but woe be unto the person that manages to mungle their PATH and instead wind up getting the (long in the tooth) OS' /usr/bin/perl instead because there's modules pulled in which have a newer use 5.xx constraint and there's much errors and blowing up and the not running (GLEIVEN!</bad professor frink>).

    Probably not an issue WRT just a PERL5OPT="-Mstrict" but be aware of that limitation if you start getting fancier.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.