my $frq_node = {}; while (){ $frq_node->{$key}[0]{$to}++ if /sending ping/; $frq_node->{$key}[1]++ if /recevied ping response/; }