Skip to content

Instantly share code, notes, and snippets.

@diegok
Created August 15, 2018 11:44
Show Gist options
  • Save diegok/5db62e864ceaa15c6c67cb9033a6afe8 to your computer and use it in GitHub Desktop.
Save diegok/5db62e864ceaa15c6c67cb9033a6afe8 to your computer and use it in GitHub Desktop.
#!/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