#!/usr/bin/perl -w use strict; my @dup_array = qw/this this array has has duplicates/; my @unique_array; my %uniques; foreach my $elem (@dup_array) { push @unique_array, $elem unless $unique{$elem}++; } print "Unique elements are @unique_array"; #### my @lines = <>;