in reply to Clarify I want to discard the set of elements if there are any duplicates.
#! /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.
|
|---|