programming-examples/perl/Hash/Is a key defined in a hash.pl

9 lines
198 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$hash{fruit} = apple;
$hash{sandwich} = hamburger;
$hash{drink} = bubbly;
if (defined($hash{'vegetable'})) {
print "Element is defined.";
} else {
print "Element is not defined.";
}