my @arr_of_names = qw(Mary John Ann);
my $txt;
my $table = qq|
|;
foreach my $key ( sort(keys %$all_names )) {
foreach my $name ( @arr_of_names ) {
if($name eq $key) {
$txt = "BAD";
$table = $table. qq|| $txt - $key |
";
}else{
$txt = "GOOD";
$table = $table. qq|| $txt - $key |
";
}
}
$table = $table. qq|
|;
print $table;