in reply to Sorting a HoH by values of the nested hashes
Fun with maps
use strict; use warnings; use 5.010; use Data::Dumper; # ip => port => count my $d = { '1.2.3.4' => { '427029' => 41, '420617' => 42, }, '1.2.3.5' => { '551509' => 51, '517427' => 52, }, '1.2.3.6' => { '671500' => 61, '622331' => 62, }, }; my $ip; say for sort map { $ip = $_;map { sprintf "%04d connections %s -> %s", $d->{$ip}->{$_}, $ip, $_ } keys %{$d->{$ip}} } keys %$d;
Cheers,
R.
|
|---|