Stripping duplicates from a list

Roger Burton West roger at
Thu Jun 12 16:29:41 BST 2008

On Thu, Jun 12, 2008 at 04:16:17PM +0100, Kake L Pugh wrote:

>Ideas for the neatest way to do this?  Everything I've come up with so
>far is clumsy or buggy.  (This might be because I'm slightly hungover,
>so sorry if this is actually a really simple problem.)

Assuming you're using a character set with a sane sorting order...

my @out;
  my %o;
  foreach my $k (sort @in) {
    my $l=lc($k);
    if (!exists $o{$l}) {
  @out=map {$o{$_}} sort (keys %o);


More information about the mailing list