while( <> ) { chomp; my( $key, $subkey ) = split; $h{$key}{$subkey}++; }