Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Numeric sorting WITHOUT <=>

by Anonymous Monk
on Oct 10, 2012 at 03:48 UTC ( #998125=note: print w/ replies, xml ) Need Help??


in reply to Re: Numeric sorting WITHOUT <=>
in thread Numeric sorting WITHOUT <=>

One may not know the minimum & maximum values without inspecting to use range operator, so ...

use strict; use warnings; use List::MoreUtils 'minmax'; my %hash = ( ... ); # Absurdity is to find end values in order to avoid # numeric comparison. my ( $min , $max ) = minmax keys %hash; for my $i ( $min .. $max ) { ... }


Comment on Re^2: Numeric sorting WITHOUT <=>
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2015-07-28 20:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls