in reply to Re^2: Finding pattern in a file
in thread Finding pattern in a file
I think this is better than the previous suggestion. As for $lookfor though, this can be implemented more efficiently with the solution shown in Building Regex Alternations Dynamically.
By the way, I understand that perl -CSDA and use Modern::Perl; no warnings qw{uninitialized}; are likely your standard boilerplate, but typically code examples should be as self-contained as possible, i.e. not depend on modules that aren't necessary, and also no warnings in general isn't really a best practice. Although I personally sometimes get annoyed by uninitialized warnings myself, it's still not something I would recommend to a newcomer as it can hide problems.
|
|---|