in reply to Re: checking array elements aginst another array
in thread checking array elements aginst another array

... better written as
   die "Unknown char! \n" unless grep { exists $testHash{$_} } @test;
This will only  die when none of the characters in the test string are 'known':
>perl -wMstrict -le "my %testHash = map { $_ => 1 } 'a' .. 'j'; for my $str (@ARGV) { my @test = split '', $str; die qq{unknown char in '$str'} unless grep { exists $testHash{$_} } @test; print qq{'$str' ok}; } " abcd axyz xyz 'abcd' ok 'axyz' ok unknown char in 'xyz' at -e line 1.
A better way to write this (assuming something like Array::Diff is not acceptable) might be:
    exists $testHash{$_} or die "Unknown char! \n" for @test;