Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: use strict without typing use strict?

by GrandFather (Saint)
on May 26, 2021 at 04:18 UTC ( #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 (Curate) 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? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2021-10-26 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (90 votes). Check out past polls.

    Notices?