The simplest way to handle this is as follows:
1. opendir/readdir the logs folder, save the file paths to @log_files
2. foreach @log_files, open file , then search it for the pattern
3. if found, push file path to @found_patterns
4. then, search file for 2nd pattern, push to @found_patterns2 on success
5. assuming files are not huge, you can slurp the file first:
open my $fh, "<", "foo" or die $!;
local $/; # enable localized slurp mode
my $content = <$fh>;
close $fh;
then you can match both patterns against $content