if ( $string =~ /^[smtwhfa]+$/ and length $string == do { my %hsh; @hsh{split //, $string} = (); keys %hsh; } ) { # everything's ok }