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 Copyright (c) 2010 ABC Startsiden AS. All rights reserved.
48
49 This library is free software. You can redistribute it and/or modify
50 it under the same terms as Perl itself.
51
53 Hey! The above document had some coding errors, which are explained
54 below:
55
56 Around line 82:
57 You forgot a '=back' before '=head1'
58
59
60
61perl v5.12.3 2010-09-22 Hash::Diff(3)