#!/usr/bin/perl

#my $filename = $ARGV[0];

#should add check loops in this listing...

($filename, @searchstrings) = (@ARGV);

open(my $fh, '<:encoding(UTF-8)', $filename)
    or die "Could not open file '$filename' $!";

my $matchstring = "$filename,";
my $match = 0;
while (my $line = <$fh>) {
    chomp $line; 
    foreach $patt (@searchstrings){
	if(($val) = $line =~ /$patt\s*:\s*(\S+)/){
	    $matchstring .= "$val , " ; 
	    $match =1;
	}
    }
}
if($match == 1){
    print "$matchstring\n";
}
