http://qs321.pair.com?node_id=11133040


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

You can turn on strict with use 5.12.0; or any explicit later version, but that's not a great way of just turning on strict because you may get unexpected side effects or limit functionality when using newer version of Perl.

I recommend to add a use $VERSION; anyway, but not 5.12.0 unless you've actually tested your code under that version. It doesn't limit functionality: If you need functionality from a newer version of Perl, you're well advised to adjust to that version in the use statement.

Unexpected side effects can occur if you add a version declaration to legacy code which hadn't one, but if you start writing your code with a version declaration, you can look it up what side effects are to expected from bumping that version.

  • Comment on Re^2: use strict without typing use strict?

Replies are listed 'Best First'.
Re^3: use strict without typing use strict?
by GrandFather (Saint) on May 26, 2021 at 06:49 UTC

    I had experimental features in mind when I mentioned "limit functionality". I agree with your observations. My key point is that using a specific version just to enable strict isn't a great idea.

    Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond