in reply to Re^2: using split
in thread using split

I sort of agree in the case of fairly trivial code like this. However the OP didn't use strict so the sample should, and when we say "always use strictures" then don't it weakens the argument a little.

Note too that this is not a "code snippet", but a full working script that demonstrates the OP's issue. <toungfirmlyincheek>Surely any complete application should include strictures?</toungfirmlyincheek>

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^4: using split
by educated_foo (Vicar) on Jun 05, 2007 at 15:09 UTC
    I can understand adding a "use strict" when it would highlight the problem, but the presence/absence of strict was strictly irrelevant to the OP's problem. I personally use strict in modules (i.e. code used by other code) but not in scripts, and find the Perlmonks "use strict" dogmatism heavy-handed and annoying.

    And surely any "complete application" should have a test suite, too, but we shouldn't expect people to include those with their replies!

      Perl gives you a whole pile of rope to do with as you like and by default doesn't do much about telling you about knots, kinks and loops tangled around your neck. Strictures go a little way toward helping coil things down in a tidy fashion.

      Ok, without the heavily drawn metaphorical image:

      Strictures cost almost nothing to add. In fact most editors will allow you to generate a template file that is used to add default text to a new document. Even experienced programmers generate typos from time to time and as with any form of bug, the sooner the error is detected the cheaper it is to fix. Indeed some editors perform dynamic syntax checking so typos are picked up immediately as the code is being entered.

      Sure, a test suite is a nice thing to have, but at the cost of at least doubling the initial cost of producing the code. Many people think them worth writing despite that. Strictures cost effectively nothing, require very little interpretation (especially for common errors), yet pick up the most common scripting language programming errors essentially immediately. Why wouldn't you use them - always.

      Dogmatic and heavy-handed? Quite possibly. Annoying? To a super-coder who never makes a typo maybe, but it really shouldn't worry most mere mortals. With good reason and in the interests of saving people time and making their lives happier? Absolutely! (Oh, and it should be "PerlMonks'" btw ;).)

      DWIM is Perl's answer to Gödel