in reply to Re^2: Am I doing Greedy Matching?
in thread Am I doing Greedy Matching?
You also chomp the line which isn't required
Quite right, it isn't required (and could hurt performance slightly on a big file). Over time, it has become part of my coding style to always use chomp when reading from a filehandle. More than once did i change the regex or some other part of the code and suddenly wondered where the newline came from. So i started using chomp unless required otherwise.
And you are using the /o option which is superfluous because there are no variables in the pattern to interpolate.
Again you are quite right. Does this actually hurt performance? I find it rather helpful when coding, even in static expressions, since i could just glance at the end and see "ok, this isn't a dynamic regex" instead of looking through the whole line noise for variables.
But thats probably just me. You know, old dogs, new tricks...
|
|---|