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


in reply to Sorting Hash / Array

I have just uploaded to CPAN a new version of Sort::Key::IPv4 that can sort network addresses in the format xxx.xxx.xxx.xxx/xxx:
use Sort::Key::IPv4 qw(netipv4keysort); my %hash = ( '127' => { 'network' => '10.182.48.0/24', 'VLAN' => '3509' }, ...); my @sorted_keys = netipv4keysort { $hash{$_}{network} } keys %hash;