1Hash::Diff(3) User Contributed Perl Documentation Hash::Diff(3)
2
3
4
6 Hash::Diff - Return difference between two hashes as a hash
7
9 use Hash::Diff qw( diff );
10 my %a = (
11 'foo' => 1,
12 'bar' => { a => 1, b => 1 },
13 );
14 my %b = (
15 'foo' => 2,
16 'bar' => { a => 1 },
17 );
18
19 my %c = %{ diff( \%a, \%b ) };
20
21 # %c = %{ foo => 1, bar => { b => 1} }
22
24 Hash::Diff returns the difference between two hashes as a hash.
25
26 diff ( <hashref>, <hashref> )
27 Diffs two hashes. Returns a reference to the new hash.
28
29 left_diff ( <hashref>, <hashref> )
30 Returns the values in the left hash that is not, or different from
31 the right hash.
32
34 This will not handle self-referencing/recursion within hashes well.
35 This will only handle HASH and SCALAR.
36
37 Plans for a future version include incorporate deep recursion
38 protection. And support for ARRAY.
39
41 Sure! Report here: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Hash::Diff
42
44 Bjorn-Olav Strand <bo@startsiden.no>
45
47 Charles McGarvey <ccm@cpan.org>
48
50 Copyright (c) 2010 ABC Startsiden AS. All rights reserved.
51
52 This library is free software. You can redistribute it and/or modify
53 it under the same terms as Perl itself.
54
55
56
57perl v5.34.0 2022-01-21 Hash::Diff(3)