foreach (@tags) { if (! exists $info->{$_}) { print "file $file doesn't have tag $_\n"; } elsif (! defined $info->{$_}) { print "file $file has tag $_, but it has no value\n"; } else { print "$info->{$_}\t"; } }