in reply to Common hash keys
$hasInt will be undef unless there's an intersection.use strict; use vars qw($hashRef1 $hashRef2); #code that puts values into the hashes my @keyIntersection = grep exists($hashRef2->{$_}), keys %$hashRef1; # Or if you just want to know if there are any use List::Util; my $hasInt = first {exists $hashRef2->{$_}} keys %$hashRef1;
throop
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Common hash keys
by lodin (Hermit) on Jun 08, 2008 at 06:37 UTC | |
by BrowserUk (Patriarch) on Jun 08, 2008 at 07:11 UTC | |
by tinita (Parson) on Jun 08, 2008 at 12:11 UTC | |
by BrowserUk (Patriarch) on Jun 08, 2008 at 15:51 UTC | |
Re^2: Common hash keys
by Anonymous Monk on Jun 07, 2008 at 18:55 UTC |