Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: use strict without typing use strict?

by GrandFather (Saint)
on May 26, 2021 at 04:18 UTC ( [id://11133035]=note: print w/replies, xml ) Need Help??


in reply to use strict without typing use strict?

Just "use strict;" and move on. 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.

There was a suggestion that it would be the default for Perl 7, but that is now off the table due to potential for breakage of legacy code.

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

Replies are listed 'Best First'.
Re^2: use strict without typing use strict?
by haj (Vicar) on May 26, 2021 at 06:15 UTC
    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.

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11133035]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-23 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found