Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: help sorting hash of hashes by value

by kcott (Archbishop)
on Apr 07, 2022 at 08:12 UTC ( [id://11142786]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    
    ...
    
    my $fmt = "foo: %s, ba: %s, value: %s\n";
    printf $fmt, @$_ for sort { $b->[2] <=> $a->[2] } @hoh_data;
    
  2. or download this
    foo: foo3, ba: baz, value: 0.0001939
    foo: foo3, ba: bar, value: 9.966003977e-06
    ...
    foo: foo2, ba: bar, value: -4.0183e-05
    foo: foo1, ba: baz, value: -0.000398154
    foo: foo1, ba: bar, value: -0.12697
    
  3. or download this
    (
      ["foo1", "bar", -0.12697],
    ...
      ["foo3", "baz", 0.0001939],
      ["foo3", "bar", 9.966003977e-06],
    )
    
  4. or download this
    (
      ["foo1", "baz", -0.000398154],
    ...
      ["foo2", "baz", 0],
    
    )
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-19 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found