Mega Code Archive

 
Categories / Perl / Hash
 

Is a key defined in a hash

$hash{fruit} = apple; $hash{sandwich} = hamburger; $hash{drink} = bubbly; if (defined($hash{'vegetable'})) {     print "Element is defined."; } else {     print "Element is not defined."; }