#!/usr/bin/perl
#
# eg5: unique elements example, fifth version..
#

use strict;
use warnings;

my @array = ( 17, 5, 3, 17, 2, 5, 7, 6, 6, 10, 3 );

# build @uniq, an array of all unique elements of @array

my %freq;		     # build array element -> frequency of that element
foreach my $x (@array)
{
	$freq{$x}++;
}

my @uniq;		     # build all unique elements of @array
foreach my $x (@array)
{
	push @uniq, $x if $freq{$x} == 1;
}
my $str = join(',',@uniq); print qq($str\n);
