Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Detecting duplicate keywords passed in a form

by diotalevi (Canon)
on Mar 21, 2003 at 14:42 UTC ( [id://244880]=note: print w/replies, xml ) Need Help??


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; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://244880]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found