Bart's regex does the trick. I was thinking of a lazy approach using sort - slower, but easier for the regex neophytes to get a handle on:
#!/your/perl/here
use warnings;
use strict;
while (<DATA>)
{
chomp;
my $sort = join '', sort split '';
( ( $sort =~ /^[afhmstw]+$/ ) # only these chars
and
( $sort !~ /([afhmstw])\1/ ) ) # no repeats
? print "<$_> OK\n"
: print "<$_> Not OK\n";
}
__DATA__
smsa
smta
stmwhas
BADsmtaEXAMPLE
__END__
<smsa> Not OK
<smta> OK
<stmwhas> Not OK
<> Not OK
<BADsmtaEXAMPLE> Not OK
-QM
--
Quantum Mechanics: The dreams stuff is made of