in reply to Re: why does sort with uniq not work together
in thread why does sort with uniq not work together

Yes, but why?

  • Comment on Re^2: why does sort with uniq not work together

Replies are listed 'Best First'.
Re^3: why does sort with uniq not work together
by 2teez (Vicar) on Nov 27, 2013 at 13:23 UTC

    Hi hdb,
    Yes, but why?
    Checking sort documentation you will find this:

    Warning: syntactical care is required when sorting the list returned from a function. If you want to sort the list returned by the function call "find_records(@key)", you can use:
    @contact = sort { $a cmp $b } find_records @key; @contact = sort +find_records(@key); @contact = sort &find_records(@key); @contact = sort(find_records(@key));
    Among other things..
    That shows it can as well use: print Dumper( [ sort &uniq( @x, @y )  ] ); showing the list to be sorted is returned from a function.

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me

      Thanks a lot!

        You are most welcome!! My brother!

        If you tell me, I'll forget.
        If you show me, I'll remember.
        if you involve me, I'll understand.
        --- Author unknown to me