http://qs321.pair.com?node_id=244880


in reply to Re: Detecting duplicate keywords passed in a form
in thread Detecting duplicate keywords passed in a form

That's better written using exists() and undef values for %dups. You've written more code than you had to. There's something to be said for only writing the necessary bits.

my @kewords = ...; my %dups; for my $keyword (@keywords) { if (exists $dups{$keyword}) { # dup } else { $dups{$keyword} = undef; } }