As with most "thou shalt nots" applied to Perls TIMTOWTDI, there is a rational behind them, but just as using the proscribed technique, method or construct blindly without fully understanding what it actually does and the implications that come from it is dangerous, so blindly trying to avoid the proscribed behaviour without understanding the reasoning is equally bad. Maybe more so.

Sometimes the 'grab all you can' behaviour is exactly the semantic that you need. One assumes, that as it is the 'default' behaviour, the people that designed and maintain the regex engine consider this to be the prevelant requirement.

Death to Dot Star! and freinds serve the very useful purpose of highlighting the implications of using the feature in an unconstrained way with regard to the implications. However, dogmatically not using the construct, when it is the right tool for the job is equally bad and 'cargo-cultish'.

Noone would advocate the total removal of the 'rd -r *' facility, despite the very real disasters that can ensue from its incorrect use.

<tongue-firmly-in-cheek>

Maybe Perl should prompt the programmer (or even popup a dialog:) with "Are you sure you want to .*"? when ever it encounters a regex that uses it. Or maybe a new /* regex option is called for that says "Yes, I'm using .* and its ok. I'm a programmer and I know what I'm doing" :)

</tongue-firmly-in-cheek>


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller



In reply to Re: An "ethical" use of dot-star ..? by BrowserUk
in thread An "ethical" use of dot-star ..? by Tanalis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.