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; } }
In reply to Re: Re: Detecting duplicate keywords passed in a form
by diotalevi
in thread Detecting duplicate keywords passed in a form
by hacker
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |