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


in reply to Detecting duplicate keywords passed in a form

Keeping order (but only keeping the last seen element of a string):
#!/usr/bin/perl -w use strict; my ($i, $keywords, @finalwords); %$keywords = map { lc($_) => $i++} qw/foo bar bat hello foo HELLO/; print join " ", @finalwords = sort {$keywords->{$a} <=> $keywords->{$b +}} keys %$keywords;
My comment here is that you can use the hash's value to preserve order as well. Comments welcome.

    --jaybonci