- Always use warnings; use strict; !
- This is not such a big issue but it's considered better and safer to use the 3-arg open and lexical filehandles, e.g. open my $fh, '<', $infile or die "Could not open $infile: $!";
- Problem: This: $/ = "#>\n"; sets the input record separator globally from that point forward, including the point in the current code where you're reading the configuration file. That means that currently, <CONFIG> will read the entire file at once. You should at least use local $/ = "#>\n"; in a new block and follow the next tip:
- Parsing the whole configuration file for every line of input is inefficient; instead read the configuration file once at the beginning of the script and store its values in a data structure such as an array of arrays for later use. This also helps avoid the previous problem of the input record separator.
- The configuration file format is unclear and the loop for $checkItem (@configLineItems) doesn't make much sense to me. This is probably also because your sample configuration file "patterns" don't match any of the messages from the sample log file. I'm going to wager a guess that the format of the configuration lines is: "Message::Pattern::Pattern" etc. In that case I would suggest that you shift the first item off the array before the aforementioned loop, as in my $message = shift @configLineItems; and then use $message instead of $configLineItems[0].
- Instead of "$Line[6]" =~ $checkItem, this is better: $Line[6] =~ /\Q$checkItem/ (however if $checkItem contains actual regular expressions, drop the \Q) - see perlre for more information. The anchors ^ and $ as well as the modifier /i may be of interest to you.
Please try these suggestions, and if you have further questions, please provide the updated code and better sample input (both logfile and configuration file), as well as the desired output.