Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
    • How, pray tell, is this particular regex going to backtrack needlessly? Or are you just cargo culting the “death to dot star” line?

      (That said, the .* in Robrt’s pattern is superfluous, as the pattern will match the exact same things with or without it.)

      • Yes, I was invoking it in the "Cargo Cult" context. The .* at the end was superfluous. He could have put them at both ends: /.*\._.*/. So, yes, I was cargo culting it. I was trying to draw attention to the fact that .* is almost never what you want to use.
        • “Death to dot star” is about backtracking. At the end of the pattern, the .* won’t backtrack. If you put another one at the front, though, it will. What is your point?

          You would have made your case much better if you just said “the .* there is a noop” instead of throwing in something entirely unrelated that happens to be about dot star.

          I was trying to draw attention to the fact that .* is almost never what you want to use.

          But you’re wrong. It is exactly what you want to use in many cases. You have to understand it, rather than using it blindly, sure, but that’s different from “it’s almost never what you want to use”. How would would you write this?

          $filename ~= m/ .+ \. (.*) /x; # get extension