http://www.perlmonks.org?node_id=21503


in reply to Regex reset problem?

You should really, really start using 'warnings' and 'strict' pragmas. Really, you should. I won't start with you, but I may just start voting down all posts that don't appear to be using those two pragmas (-w switch and strict pragma, I guess).

It really isn't good coding to go without them.

J. J. Horner
Linux, Perl, Apache, Stronghold, Unix
jhorner@knoxlug.org http://www.knoxlug.org/

Replies are listed 'Best First'.
RE: Re: Regex reset problem?
by sz (Friar) on Jul 07, 2000 at 19:36 UTC
    J.J.,

    I agree totaly. I use both -w and strict in longer code. I suppose no code is too short or temporary to benefit, however.

    Thanks...
      You two should relax. There's many a way to do things... and if they werk correctly... well can they be wrong? Maybe some hackers are too lazy to type those things or to even deal with the occassional messages that they produce. Maybe they're afraid of them or don't like them or ... have no good reason at all like me. =)

      Maybe you (and others) fundamentally object to my opinion (even on particularly informed and experiential grounds) but I feel that the level of warnings and strictness any PerlMonk would like to adhere to is a personal decision that should not be belittled. If there is a more enlightened way, please kindly explain how and why. Otherwise, your assertions seem elitist and shallow... at least to me. Please don't take this as any sort of kerosene-wielding confrontation but rather an opinion and an interested query for further explanation (as well as the hope of increased tolerance). Thanks very much. TTFN.

      -PipTigger

      p.s. the most cigarettes

        The reason is, because nobody who has spent much time coding has been spared from the rare (or for some of us, not-so-rare) typo. regardless of how we would like things to be, we all accasionaly make little mistakes, typographical, syntactical, or structural. With use strict and use warnings you can catch most of this right away. It is precisely laziness that prompts strict adherance to strict. Maybe I'm just a complete moron, but I have spent 4 hours just on a single typo that strict would have caught, and that's certaily more time than I've spent typing pragmas.
        Paris Sinclair    |    4a75737420416e6f74686572
        pariss@efn.org    |    205065726c204861636b6572
        I wear my Geek Code on my finger.
        
        One reason is because I don't want to debug a variable-name typo that those defensive practices would have caught in ten seconds... and I'm sure people don't want to have their posts here ignored.

        Besides that, I've learned more about Perl by having to take code that barely works and make it pass the strict test.

        There's a minimum standard of posting here that we really ought to take into account. People should be able to pare down their code into the smallest snippet that illustrates the program. They need to provide the exact error messages they encounter. They ought to format it nicely. They should list what they've already tried, if applicable. If they're running CGI scripts, they must use Taint mode.

        Given all that, I don't think typing an extra 15 characters per script is an unreasonable burden. Take taint mode, for example. I wouldn't hire any CGI programmer who doesn't use -T because it's his "valid personal decision". Sure, it may work now, but when things fall apart in the future, having saved a few minutes writing code will be forgotten.