Skip to content

Instantly share code, notes, and snippets.

@Osse
Created August 22, 2012 15:56
Show Gist options
  • Save Osse/3426980 to your computer and use it in GitHub Desktop.
Save Osse/3426980 to your computer and use it in GitHub Desktop.
Find duplicates
sub findDuplicates {
# @info is an array of hashrefs
my @keys = keys $info[0];
grep {
for (my $i = 0; $i < scalar(@info) - 1; $i++) {
# I want to remove any keys from @keys if two adjacent
# values in $info are unequal for the same key
$info[$i]{$_} eq $info[$i]{$_}
}
} @keys;
return @keys;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment