Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: My questions: new to perl

by ikegami (Pope)
on Mar 13, 2011 at 18:27 UTC ( #892970=note: print w/replies, xml ) Need Help??


in reply to Re^2: My questions: new to perl
in thread My questions: new to perl

That's an incomplete answer. local can localized elements of lexical arrays (and hashes) as well.

Thanks, added.

That's the first time I hear someone claim strict has anything to do with backwards compatibility reasons. If that were true, no code written in the past 15 years would have had the need for "no strict"

You didn't finish your thought. Are you saying you disagree with the conclusion? How so?

By the way, strict is now on by default in Perl 5.12 (the language, not the interpreter).*

But on other cases, it's just plain wrong [...] For instance, the code I posted above isn't warnings free

Comma in qw() is most definitely likely to be an error. I for one have taken advantage of this warning a couple of times.

* — To use Perl 5.12, add use 5.012;.

Update: Added "*".

Replies are listed 'Best First'.
Re^4: My questions: new to perl
by JavaFan (Canon) on Mar 13, 2011 at 20:30 UTC
    Are you saying you disagree with the conclusion?
    Most certainly.

    strict has been around as long as perl5. Which is as long as we have namespaces, and Exporter. Exporter only works by doing things strict forbids - but which weren't even possible before. So, strict forbids something that has only been possible for as long as strict exists. Not really "for backwards compatible reasons".

    By the way, strict is now on by default in Perl 5.12
    Except that it's not.
    print $], "\n"; $foo = 3; print $foo, "\n"; __END__ 5.012001 3
    Perhaps you mean that use 5.012; implies use strict;?
    Comma in qw() is most definitely likely to be an error.
    They are seldomly an error in my code (for instance, in the code shown), and nor are #'s in my qw's.
    I for one have taken advantage of this warning a couple of times.
    That I will not deny. But since the presence of commas can be detected without running the program, I do not think checking for this at every run is required. This is something that belongs in a linter. Perlcritic is a linter, and works wonders for tons of people.

      By the way, strict is now on by default in Perl 5.12

      Except that it's not.

      Did you deliberately misquote me? I specifically said version 5.12 of the interpreter wasn't sufficient.

      Since 5.10, Perl has been changing in backwards incompatible ways. To get the latest version of the language, you need to request it using use 5.010; or similar.

      But since the presence of commas can be detected without running the program, I do not think checking for this at every run is required.

      Either you didn't express yourself properly, or you just advocated that strict var checks be moved to the linter.

        Did you deliberately misquote me? I specifically said version 5.12 of the interpreter wasn't sufficient.

        Since 5.10, Perl has been changing in backwards incompatible ways. To get the latest version of the language, you need to request it using use 5.010; or similar.

        Did you mean you found a convoluted way (which I did not understand) to describe use 5.012;? If you meant that, why didn't you say so?

        Not that I agree use 5.YYY; switches to different versions of the language. Or that without using use 5.XXX; you won't be getting any of the latest version. *Most* changes of the language you'll get with, or without use 5.XXX. (Smart match for instance, all of the regexp changes, new versions of Unicode, etc).

        Either you didn't express yourself properly, or you just advocated that strict var checks be moved to the linter.
        First of all, strictness checks aren't warnings. Second, due to exporting, one actually needs to run code to know what's being exported - and hence whether strict vars will complain or not.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2018-11-19 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (210 votes). Check out past polls.

    Notices?