Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Rolling DND Dice.

by grendelkhan (Sexton)
on Feb 04, 2004 at 03:08 UTC ( [id://326393]=note: print w/replies, xml ) Need Help??


in reply to Re: Rolling DND Dice.
in thread Rolling DND Dice.

See, I was going to use sort to get the highest three values, but sort slaps together repeated values, so that sort(1,3,3,7) gives (1,3,7). Is there some way around this? I think there's a pragma to make sort use a stable method (which would have the side effect of not deleting dupes?), but it's in 5.8, and I'm using 5.6 here. (Old, old distribution which desperately needs an upgrade.)

Replies are listed 'Best First'.
Re: Re: Re: Rolling DND Dice.
by blokhead (Monsignor) on Feb 04, 2004 at 04:27 UTC
    Huh?
    $ perl -e 'print join " ", sort 1,1,1,3,3,7' 1 1 1 3 3 7
    Unstable sorting means input order isn't preserved for ties, not that stuff is removed. By your reasoning, sort { 0 } @array would just return one element every time, since all the items are tied in sorting order.

    blokhead

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 23:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found