#!/usr/bin/perl # 862294 use strict; use warnings; my $file = "keywords.txt"; open(my $fh_keys, '<', $file) or die "Can't open $file for read: $!"; my $keys = <$fh_keys>; close ($fh_keys); chomp $keys; my @keys = split(',', $keys); my ($keyword1, $keyword2, $keyword3) = @keys; my $logfile = "Skypelogs.txt"; open (my $fh_log, '<', $logfile) or die $!; my @log = <$fh_log>; my $line; for $line(@log) { if ($line =~ /($keyword1|$keyword2|$keyword3)/i) { my $found .= $line . "\n"; print $found; } } =head OUTPUT: 001 This is a convstn with "please" and "urgent" in it. SHOULD MATCH 003 Call failed. Aborted. SHOULD MATCH. 004 Call includes "call." This is foolish but SHOULD MATCH =cut