logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Hash::Diff - Return difference between two hashes as a hash

Author

       Bjorn-Olav Strand <bo@startsiden.no>

Bugs

       Sure!  Report here: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Hash::Diff

Caveats

       This  will  not  handle  self-referencing/recursion  within  hashes well.  This will only handle HASH and
       SCALAR.

       Plans for a future version include incorporate deep recursion protection.  And support for ARRAY.

Contributor

       Charles McGarvey <ccm@cpan.org>

Description

       Hash::Diff returns the difference between two hashes as a hash.

       diff ( <hashref>, <hashref> )
           Diffs two hashes.  Returns a reference to the new hash.

       left_diff ( <hashref>, <hashref> )
           Returns the values in the left hash that is not, or different from the right hash.

Name

       Hash::Diff - Return difference between two hashes as a hash

Synopsis

           use Hash::Diff qw( diff );
           my %a = (
                       'foo'    => 1,
                   'bar'    => { a => 1, b => 1 },
               );
           my %b = (
                       'foo'     => 2,
                       'bar'    => { a => 1 },
               );

           my %c = %{ diff( \%a, \%b ) };

           # %c = %{ foo => 1, bar => { b => 1} }

See Also