in reply to Detecting duplicate keywords passed in a form
Keeping order (but only keeping the last seen element of a string):
--jaybonci
My comment here is that you can use the hash's value to preserve order as well. Comments welcome.#!/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;
--jaybonci
|
---|
In Section
Seekers of Perl Wisdom