http://www.perlmonks.org?node_id=998125


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 ) { ... }