in reply to Re: Detecting duplicate keywords passed in a form
in thread Detecting duplicate keywords passed in a form
diotalevi's method looses the order. This maintains the order.
my @keywords; { #closure so %temphash gets garbage collected my %temphash; foreach ( map {lc} qw(this that other foo THIS bar)) { next if exists $temphash{$_}; $temphash{$_} = undef; push @keywords, $_; } } print join " ", @keywords; ___OUTPUT____ this that other foo bar
--
flounder
|
---|
In Section
Seekers of Perl Wisdom