sub queries() { if ( -f and /^ftr001/ ) { print "----------------------------------------------\n"; print "Searching File:", $_, "\n"; print "----------------------------------------------\n"; open(UNZIP, "gunzip -dc < $_ |") or die "gunzip: $!"; open(RECORDS, "/tmp/logs/records.txt") or die "Could not open records file: $!"; my @REC=; chomp @REC; my $RE = join '|', map { quotemeta $_ } @REC; $RE = qr/($RE)/; while ( ) { print "Searching for: $1\nFound it in: $_\n" if /$RE/ } } }