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