Skip to content

strange interaction of 'uniq' and 'sort' #20

@chrispitude

Description

@chrispitude

For the following code:

use warnings;
use strict;
use Acme::Tools;

my @vals1 = ('a', 'dup');
my @vals2 = ('z', 'dup');
my @new_values = sort uniq (@vals1, @vals2);

print "VALUES:@new_values\n";

I get the following output:

VALUES:a dup z dup

If I replace sort uniq with distinct (obviously the better coding style), then I get the expected result:

VALUES:a dup z

What would cause this? Is there some strange interaction between sort and the argument template for uniq?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions