Created
August 15, 2018 11:44
-
-
Save diegok/5db62e864ceaa15c6c67cb9033a6afe8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use Mojo::Base -strict, -signatures; | |
use Data::Dump qw/pp/; | |
say pp diffhash( { map { $_ => 1 } 1..30 }, { map { $_ => 1 } 20..60 } ); | |
sub diffhash($h1, $h2) { | |
my ($h1p, $h2p) = ({%$h1}, {%$h2}); | |
for (keys %$h1) { | |
if ( exists $h2->{$_} ) { | |
delete $h1p->{$_}; | |
delete $h2p->{$_}; | |
} | |
} | |
return $h1p, $h2p; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment