Hash::Diff(3pm)
π Hash::Diff π
okay bestie, so you know how you've got two hashes and you're like "what even changed between y'all"?? this is the module for that. Hash::Diff β it gives you back the difference between two hashes as a hash. like, a whole new hash. slay.
β¨ 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 how %c just β¨appearsβ¨ with the tea? that's the whole vibe. π«Ά
πΈ DESCRIPTION πΈ
Hash::Diff returns the difference between two hashes as a hash. that's the whole thing. it's giving minimalist icon. π
diff ( <hashref>, <hashref> )
diffs two hashes. returns a reference to the new hash. that's the main character right there. π
left_diff ( <hashref>, <hashref> )
returns the values in the left hash that is not, or different from the right hash. so like, left side only, bestie β everything on the left that either isn't on the right at all or just isn't matching. π
π CAVEATS π
okay listen, we have to be honest with each other here. π
- this will not handle self-referencing/recursion within hashes well. like at all. it will get confused and we will not be helping it.
- this will only handle HASH and SCALAR. that's the whole menu.
plans for a future version include incorporate deep recursion protection. and support for ARRAY. so like, someday. manifesting it. π¦
fr fr though: don't come for this module with a self-referencing hash and expect magic. it said what it said.
π BUGS π
sure! report here: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Hash::Diff
(the energy of "sure!" followed by a link is honestly iconic and i will not be changing it π)
π AUTHOR π
Bjorn-Olav Strand <bo@startsiden.no>
π CONTRIBUTOR π
Charles McGarvey <ccm@cpan.org>
π COPYRIGHT π
Copyright (c) 2010 ABC Startsiden AS. All rights reserved.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
and that's the page, bestie!! πΈβ¨ this one's documented under perl v5.36.0, dated 2022-12-12 β go forth and diff your hashes, no cap. π«Άπ
π¦ where this page comes from
- debian bookworm: libhash-diff-perl 0.010-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhash-diff-perl 0.010-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhash-diff-perl 0.010-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhash-diff-perl 0.010-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhash-diff-perl 0.010-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms