I am unsure how to compare arrays of hashes ... -- Lady_Aleena
The comment "Data::Compare does have the facility to compare array references" does not apply with respect to the above doubt. With combination of ...
# I have not figured out this part yet. # elsif (ref($old) eq 'ARRAY' && ref($new) eq 'ARRAY') { # }
... it seems you are unsure about comparison of array reference of hash references. (Loose language sinks ships. ;-) Regardless, you would need to loop over array (reference) elements near the beginning of the sub ...
sub deep_data_compare { my ( $old, $new ) = @_; if (ref $old eq 'ARRAY' && ref $new eq 'ARRAY') { # Handle the case of uneven number of elements in # each array reference as you see fit. Here assumption # is that both references have the same number of # elements. for my $ix ( 0 .. $#{ $old } ) { deep_data_compare( map $_->[ $ix ], $old, $new ) } } ... }
In reply to Re^2: Using Data::Compare recursively to better identity differences between hashes
by Anonymous Monk
in thread Using Data::Compare recursively to better identity differences between hashes
by Lady_Aleena
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |