use strict; use warnings; my $str=""; for $str('aaa'..'ccc') { if($str=~m/^[abc]{3}$/ && $str!~m/(.*a.*a)/ && $str !~ m/(.*b.*b)/ && $str!~ m/(.*c.*c)/) { print "\' $str \' is a Match\n"; } }