#OPEN FILE open(FH,"<$fs") || die ("cannot open file"); while () { ($host,$cfg,$sup) = split /::/,$_; $cfg =~ s/\*//g; push @FS,$cfg}; #LOOP THROUGH ARRAY and look for MATCH foreach my $item (@config){ print "$item\n"; foreach my $item2 (@FS){ if ($item =~ /$item2/){ print "MATCH = $item ------> $item2\n";} } }