#!/usr/bin/perl -w use strict; use vars qw ($outfile @array); open(DATA, $ARGV[0]) or die "Couldn't open $ARGV[0]: $!"; $outfile = "whatever.txt"; open (OUT, ">$outfile") || die "Can't open $outfile for creation: $!\n"; ############## ############## This section could be used if one doesn't care about order #my %uniq; #$uniq{$_}++ while ; #print OUT for keys %uniq; ############## ############## my (@array, %hash); while () { push (@array, $_) unless (defined($hash{$_})); $hash{$_} = 1; } print OUT join("", @array);