in reply to Re: How best to compare hash values?
in thread How best to compare hash values?
my %hash1 = (); # Initialize empty hash. Perhaps unnecessary?Yes, this is unnecessary. Either:
my %hash1;
or:
my %hash1 = ( "1", "20", "2", "20", "4", "19", "5", "20", "10", "20", "6", "18");
Fat commas are nice too: 1 => 20,
I created a sub "isNull" as a homegrown replacement for "exists". The idea is to check your assumptions (and data) before you operate on that data.Your isNull sub is not need with your data. Try:
unless ($hash2{$thisKey}) {
instead of:
if (isNull(\%hash2, $thisKey)) {
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: How best to compare hash values?
by jimbass (Novice) on May 06, 2010 at 19:18 UTC | |
by elwarren (Priest) on May 06, 2010 at 22:08 UTC |