#! /usr/bin/perl use strict; use warnings; my @combinations = qw{ scan print rinse repeat }; my @test_strings = do{local $\;}; chomp @test_strings; for my $string (@test_strings){ my @misses; for my $ele (@combinations){ next if $string =~ /\Q$ele\E/; push @misses, $ele; } print $string, q{ -> }; if (@misses){ print qq{no matches for: @misses\n}; } else{ print qq{all matched\n}; } } __DATA__ scan and print and rinse and repeat print and scan and rinse and repeat print and scan and rinse print #### scan and print and rinse and repeat -> all matched print and scan and rinse and repeat -> all matched print and scan and rinse -> no matches for: repeat print -> no matches for: scan rinse repeat