On Tue, Jun 07, 2005 at 07:33:27PM -0400, Bob wrote:
> Do I need this? I'm getting six to nine dupes to the
> same recipient from a worm, and even though I
> can deny that worm at rcpt, I'd like to fix the hole,
> wherever it is, that is allowing duplicate recipients
> for one message.
> 
> sub _uniq {
> my %u = () ; for ( @_ ) { $_ and $u{$_} = 1 } ; keys %u if ref \%u ;
> }

There's an even neater way to write uniq, which also preserves the order:

my %u = (); grep { ! ($u{$_}++) } @_;

List operators are so useful !  A better perl bod than me could probably
avoid the named hash too :)

Nick

Reply via email to