You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
366 B
Perl

#!/usr/bin/perl
use strict;
use warnings;
my %hash = ('Key1' => 'Value1', 'Key2' => 'Value2');
my $key = 'Key1';
if (exists $hash{$key}) {
if (defined $hash{$key}) {
print "$key exists and is defined as $hash{$key} \n";
} else {
print "$key exists but is not defined \n";
}
} else {
print "$key does not exist\n";
}