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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
ozoCommented:
while( <> ){
   s/\s+$//;
   @hash{split/\./} =();
}
print "$_\n" for keys %hash;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.