for my $m (keys %msg) { print "$m $msg{$m}{to} send message from $msg{$m}{from}\n"; }