in reply to Re: Comparing two hashes for duplicate keys with no case sensitivity
in thread Comparing two hashes for duplicate keys with no case sensitivity

That's clever, but I count two loops (and you should probably use \Q...\E as well).

  • Comment on Re^2: Comparing two hashes for duplicate keys with no case sensitivity
  • Download Code

Replies are listed 'Best First'.
Re^3: Comparing two hashes for duplicate keys with no case sensitivity
by pat_mc (Pilgrim) on Aug 15, 2008 at 16:36 UTC
    Hm ... where is the second loop you're seeing, chromatic? Is the join operator an undercover loop as well? Clearly, if the complexity of the join operation is equivalent to that of a regular for loop we don't gain much.

    Cheers -

    Pat

      Yes, join is O(n) where n in this code is the number of keys in the hash. Perl's implementation is slightly more efficient for join than Perl-side iteration, but that's why there's a join operator.