Skip to content

Instantly share code, notes, and snippets.

@ray1729
Created June 14, 2012 09:49
Show Gist options
  • Save ray1729/2929361 to your computer and use it in GitHub Desktop.
Save ray1729/2929361 to your computer and use it in GitHub Desktop.
Build array of unique data from a file
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
my %seen;
my @uniq;
while ( <> ) {
chomp;
# Split on whitespace
my @data = split;
# First three columns are the key
next if $seen{$data[0]}{$data[1]}{$data[2]}++;
push @uniq, \@data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment