Created
November 29, 2012 20:08
-
-
Save warewolf/4171569 to your computer and use it in GitHub Desktop.
dedupe with a haSh in perl
This file contains hidden or 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/perl | |
| use strict; | |
| use warnings; | |
| my @values = qw( a b c d a b c d a b c d); | |
| my %dedupe_hash; | |
| foreach my $value (@values) { | |
| $dedupe_hash{$value}++; | |
| } | |
| foreach my $key (keys %dedupe_hash) { | |
| my $value = $dedupe_hash{$value}; | |
| print "key $key has value $value\n"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment