foreach (@sorted_data) { /(.*?)\.(.*)/; $hash{$1} = $2; } # print hash here by key value - only latest entry exists #### foreach (@sorted_data) { my ($key, $value) = split /\./, $_, 2; $hash{$key} = $value; } # print hash here by key value - only latest entry exists