in reply to log parsing very slow

By looping over your masks inside a loop over the lines over your log file, you are forcing to recompile a new regex for each line, for each mask. So, if you have 5 masks, and 100,000 lines in your log file, you are forcing Perl to compile 500,000 regular expressions.

If you have one mask, Perl knows the regex hasn't changed, so it won't recompile - hence you will compile only one regex, despite your 100,000 lines of code.

You can do two things - either switch the order of the loops , that is, for each mask, create a regex, then loop over the log file (first seeking back to the start of the file!), or create an array of compiled regular expressions, and loop over them.

Perl --((8:>*