Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: How do I remove the duplicates from the array?

by hdb (Monsignor)
on Sep 26, 2013 at 14:18 UTC ( [id://1055844]=note: print w/replies, xml ) Need Help??


in reply to Re^2: How do I remove the duplicates from the array?
in thread How do I remove the duplicates from the array?

I do not understand the line $sort[-1]>$sort[0] ? $sort[-1] : undef. What if the values are 7, 8, 8? How will it discard the whole thing? I know the OPs spec is rather cryptic but my understanding was, that the values are to be blanked out if the max occurs more than once.

Replies are listed 'Best First'.
Re^4: How do I remove the duplicates from the array?
by LanX (Saint) on Sep 26, 2013 at 14:45 UTC
    > I know the OPs spec is rather cryptic but my understanding was, that the values are to be blanked out if the max occurs more than once.

    hmm ... ok my understanding was to discard if all are maximum, see (3,3,3)

    But your definition is indeed closer to the naming highlander, maybe peak was better.

    edit

    For highlander compare with [-2] if there are more than 2 elements.

    BTW: "cryptic" is an euphemism for incompetent ... if you can't express such a problem in words you don't deserve being called a programmer.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      Unless the OP clarifies, it is probably not a meaningful discussion...

        > Unless the OP clarifies, it is probably not a meaningful discussion...

        well ... as usual, see my BTW in the edit! =)

        I'm trying to avoid such threads, but I thought that abstracting to functions like highlander or peak might be useful for

        • clarification
        • documentation
        • reusability

        Cheers Rolf

        ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1055844]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-03-19 05:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found