in reply to why does sort with uniq not work together

why it does not execute uniq beforehand
But it does, it executes uniq as the function that tells sort how to compare elements, as in
sort { uniq($a, $b) } @x, @y;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: why does sort with uniq not work together
by Anonymous Monk on Nov 27, 2013 at 22:34 UTC

    Looks like it :)

    $ perl -le " sub uniq {warn++$q;@_} print for sort uniq(1,8,4,3) " 1 at -e line 1. 2 at -e line 1. 3 at -e line 1. 4 at -e line 1. 1 8 4 3 $ perl -MO=Deparse -le " sub uniq {warn++$q;@_} print for sort uniq(1, +8,4,3) " BEGIN { $/ = "\n"; $\ = "\n"; } sub uniq { warn ++$q; @_; } print $_ foreach (sort uniq 1, 8, 4, 3); -e syntax OK