use strict; use warnings; use Test::More tests => 2; my $goodstr = 'Can you suggest code to determine whether a string contains all of a list of characters in any order?'; my $badstr = 'How to ask better questions using Test::More and sample data'; my @list = qw/? s a y/; ok haschars ($goodstr, @list), 'Match'; ok !haschars ($badstr, @list), 'No match'; sub haschars { my $str = shift; for my $c (@_) { return 0 if -1 == index $str, $c; } return 1; }