|
Perl diving headfirst into the Osborne Effect and then sleeping for a decade certainly didn't help, but I agree that the core reason Python and Ruby took over is because they have easier to read syntax. TMTOWTDI is a great philosophy until you discover it means to understand everyone else's code that you need to know every dark corner of the language; and that's a huge drag on adoption in every niche outside of single-maintainer/one-off scripts.
|
# ¿ Oct 29, 2023 04:28 |
|
|
# ¿ May 12, 2024 07:14 |
|
Hughmoris posted:Rookie perl question: An example To explain for a perl rookie, the check is: pre:if ($var =~ /(:|,)22(,|$)/) {
biznatchio fucked around with this message at 04:33 on Apr 15, 2024 |
# ¿ Apr 15, 2024 04:29 |
|
In my experience, the only time you ever need to worry about regex performance is if you have backtracking; and even then only when you fall into a catastrophic backtracking case that generally only happens when you stack multiple variable length operators on top of each other. Neither of the provided regexes use a concerning backtracking pattern, so their performance differences are almost certainly immaterial, even across 1GB of data. From a performance perspective, Knuth's quote on the matter applies here: quote:The real problem is that programmers have spent far too much time worrying about efficiency in the wrong places and at the wrong times; premature optimization is the root of all evil (or at least most of it) in programming. Choose one or the other based on readability; because in this case you're going to spend more wallclock time looking at the pattern as the developer than the CPU will spend actually executing it. (And it is worth pointing out that neither pattern will work correctly if the strings might ever contain IPv6 addresses; some additional pattern work would be necessary to distinguish colons in the address from the colon separating the address from the port list.)
|
# ¿ Apr 18, 2024 02:45 |