# uniqfiles.pl use strict; # helps prevent silly mistakes use warnings; # helpful when writing code while (<>) { # Reads from STDIN if (/^(\w+)\t/) { # If the line starts with one or more 'word' characters followed by a tab... my $filename = $1; # ...assume we've got a filename captured $uniq_fnames{$filename} = 1; # ...and add it to our hash. } } print $_,"\n" for keys %uniq_fnames; # prints to STDOUT, can be piped to a file