- or download this
%a = ( one=>1, two=>2, three=> 3 );
%b = ( two=>'two', three=>'three', four=>'four');
- or download this
if (exists $a{one}) { print "\%a has 'one' for a key" }
- or download this
print join(",", keys %a); # prints "one,two,three"
- or download this
my @common_keys;
foreach my $key (keys %a) {
...
push @common_keys, $key;
}
}
- or download this
my @common_keys = grep { exists $b{$_} } keys(%a);
- or download this
$x = \%a;
$y = \%b;
- or download this
my @common_keys = grep { exists $y->{$_} } keys( %{ $x } );