in reply to Re: comparing elements in 2 hashes...
in thread comparing elements in 2 hashes...
The whole idea is that a hash lets you "instantly" look up whether a given key exists in it WITHOUT having to loop over all the keys...foreach $bkey (sort keys %build_file) { if (exists $file_list{$bkey}) print "YES\n"; } else{ print "NO\n"; } }
Your code would work, but it would take n*m time, where n's the number of entries in build file, and m's the number in file_list.
This version takes about n time, m times quicker.
--
Mike
|
---|