in reply to Re: Re: removing duplicated elements from array, with a difference
in thread removing duplicated elements from array, with a difference

Thanks for your help, but I've realised that I need to do the same problem except that the duplicate may be a particular pattern within an element. So therefore all those elements containing that pattern need to be removed. thanks again, paul
  • Comment on Re: Re: Re: removing duplicated elements from array, with a difference

Replies are listed 'Best First'.
Re: Re: Re: Re: removing duplicated elements from array, with a difference
by BrowserUk (Patriarch) on Aug 28, 2002 at 18:53 UTC

    This should do it if your pattern is can be reliably matched by a single regex

    my $pattern = qr/a regex that matches your pattern/; my @deduped = grep { !exists $count{$_} or $count{$_} == 1 } map { /$pattern/ and $count{$_} ++; $_ } @data;

    What's this about a "crooked mitre"? I'm good at woodwork!