in reply to Removing duplicate hashrefs from an array

You are generating new hash refs in each iteration so your concept is already doomed to fail. The ref has no relation to the uniqueness of it's values.

Either follow Choroba's suggestion to check the uniqueness of the hash values or try a %seen hash with concanated keys.

Ie checking $seen{join $; , values %$href }++

(see $; in perlvar for details)

(see http://perldoc.perl.org/perlfaq4.html#How-can-I-remove-duplicate-elements-from-a-list-or-array%3f too)

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

Replies are listed 'Best First'.
Re^2: Removing duplicate hashrefs from an array
by msomanat (Initiate) on Oct 06, 2014 at 05:54 UTC
    Thank you LanX. I should have thought on that - the uniqueness of the href. However, as you suggested, I concatenated the values, and that did the trick. :) But, there should be a straight forward method to compare these hashes within the array. Anyway, Thanking everyone for the suggestions.
      > But, there should be a straight forward method to compare these hashes within the array

      Look the point is that your whole data structure is not straight forward.

      Why an AoH if you want uniqueness?

      And which entry should be unique, really both or all??

      Using %seen if common knowledge (see FAQ) and "combined uniqueness" needs combination, that's to unusual for a special operator and straight forward to implement.

      Cheers Rolf

      (addicted to the Perl Programming Language and ☆☆☆☆ :)