use Test::Simple 'no_plan'; use strict; use constant DEBUG=> 1; sub debug; sub debug { print STDERR (+shift) ."\n" if DEBUG; } my $string = 'This is a great string here. Really. It even has an @ char.'; # no.. for my $chars( qw(12345 %!$*& ^ 9 x) ) # interestingly fails for ^ ok( ! string_has_chars($string => $chars ) , " we dont have '$chars'"); } # yes.. for my $chars( qw(even has an @ char .Really) ){ ok( string_has_chars($string => $chars ) , " we do have '$chars'"); } sub string_has_chars { my $string = shift; my %char; ARG: for my $element (@_){ defined $element or next; if ( ref $element and ref $element eq 'ARRAY' ){ $element="@$element"; } for my $char ( split('',$element) ){ $char{$char}=0; } } my @chars = sort keys %char; debug("chars are [@chars]"); for my $c (@chars){ $string=~/$c/ or return; } return 1; }