TIMTOWTDI.
use strict; use warnings; use Test::More tests => 2; my $goodstr = 'Can you suggest code to determine whether a string cont +ains 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; }
See also How to ask better questions using Test::More and sample data.
🦛
In reply to Re: string containing characters
by hippo
in thread string containing characters
by IvanH
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |