#!/usr/bin/perl -w use strict; @ARGV = qw(a b c c d); #remove the extra "c" my @inputs = (); my @values = (); @inputs = @ARGV; foreach my $elemnt (@inputs) { # if (grep {$_ ne $elemnt} @values) if (!grep {$_ eq $elemnt} @values) { push @values, $elemnt; } } print "@values\n";
In reply to Re: Finding unique elements in inputs
by BillKSmith
in thread Finding unique elements in inputs
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |