in reply to Writing general code: real world example - and doubts!

I have to caution you that all those detaint regexes also remove a trailing \n (and outright fail if there's a \n anywhere but at the end). Use the //s flag, and also train yourself to use \z instead of $ when you mean true end-of-string. (AIUI, both these problems are removed in perl6; . and $ can be used more naturally there.)
  • Comment on Re: Writing general code: real world example - and doubts!

Replies are listed 'Best First'.
Re^2: Writing general code: real world example - and doubts!
by polettix (Vicar) on Apr 05, 2005 at 09:01 UTC
    This leads to one more meditation: should I craft my examples carefully before posting them, exercitating the Hubris quality, or should I write them deliberately "naive" so that all this bunch of da*ned good advices pop up? I'm starting to think that the latter is the right way - my examples are clearly in this direction :) - but I fear that only a small percentage of all these will actually penetrate into my brain. Better than nothing.

    This is also an indirect answer to my original topic: I think that I'll have to concentrate on solving the real problem (e.g. detainting a variable in the correct way, using the right regexes) before thinking about generalisations.

    Flavio (perl -e "print(scalar(reverse('ti.xittelop@oivalf')))")

    Don't fool yourself.