Storing data into a hash from file

I have a file which has this format each word dot separated:
SubAcctDtls.Id.IdAndPurp
SubAcctDtls.Id.IdAndPurp.Id
SubAcctDtls.Id.IdAndPurp.Id.Prtry
SubAcctDtls.Id.IdAndPurp.Id.Prtry.Id

I want to store each word in a hash. And I dont want store any duplicates in the hash i.e I want to store SubAcctDtls,Id,IdAndPurp,Prtry in the hash. Please advise.
saibskAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
ozoConnect With a Mentor Commented:
while( <> ){
   s/\s+$//;
   @hash{split/\./} =();
}
print "$_\n" for keys %hash;
0
 
ozoCommented:
Hashes don't store duplicate keys
0
 
saibskAuthor Commented:
how should i store the data in the hash while reading from the hash?
0
 
ozoCommented:
What do you mean when you say store the data in the hash while reading from the hash?
How are you doing it now,
what does it produce, and what do you want it to produce?
0
 
saibskAuthor Commented:
Sorry How do i store the data in the hash while reading from the file. I want to store in the hash something like this
SubAcctDtls
Id
IdAndPurp
Prtry
0
All Courses

From novice to tech pro — start learning today.