Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Re: Detecting duplicate keywords passed in a form

by diotalevi (Canon)
on Mar 21, 2003 at 14:42 UTC ( #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? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-08-18 02:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?