#! /usr/bin/perl use strict ; use warnings ; my @arr = qw| one two three four five | ; my %element_count = () ; foreach ( @arr ) { $element_count{$_}++ ; } foreach ( values %element_count ) { undef @arr if $_ > 1 ; }
Originally posted as a Categorized Answer.
In reply to Re: Clarify I want to discard the set of elements if there are any duplicates.
by DamnDirtyApe
in thread Clarify I want to discard the set of elements if there are any duplicates.
by toddprof
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |