Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^3: Sort hash with values

by AnomalousMonk (Chancellor)
on Jun 24, 2013 at 19:44 UTC ( #1040484=note: print w/replies, xml ) Need Help??

in reply to Re^2: Sort hash with values
in thread Sort hash with values

The only change i have done is reversing the hash.

A naive hash reversal works just fine if the hash values are unique to begin with. If they're not, somebody's gonna get (silently) clobbered. Maybe add a pre/post reversal size check:

>perl -wMstrict -le "my %hash = qw(a aye b bee c see eh aye); ;; my $pre_k = keys %hash; %hash = reverse %hash; $pre_k == keys %hash or die 'somebody got clobbered'; " somebody got clobbered at -e line 1.

Replies are listed 'Best First'.
Re^4: Sort hash with values
by sammy_01 (Initiate) on Jun 25, 2013 at 10:53 UTC
    Oh Yes, i do agree with you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040484]
[Corion]: I just found out that in $current_top_prior ity_project , the part I am in is not even in the top three worries. That's somewhat bad, not because I'm happy with being a top worry but because that means that I don't even know how bad the rest ...
[Corion]: ... of the situation is :-)
[marto]: it's good to know that things can always get worse :P
[hippo]: Ignorance can be bliss
[Corion]: hippo: Yeah - I'll just avoid the project lead :)
[Corion]: marto: Yeah, it helps with the perspective :-D

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2017-07-26 08:11 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (385 votes). Check out past polls.