Hashf a hash of a hash of a hash

I need to write a code that sorts filenames under different environements.

The heirarchy is as shown below-
Plan (around 50 palns)
Chapter (over 300)
Milestone (1,2,3,4)
Platform (A,B)
Owner(around 30)
Filenames (over 10000)

There are several plans. And each plan has several chapters. A plan and chapter of the same name can be present in another environment.
Now each chapter has filenames with the details of their owner and the milestone and platforms they are related to. Despite having same names the chapters can and will have different content in different environment.
I need to access these filenames and print them out in the followwing format

Plan: the plan its accessing
Chapter: the chapter under that plan
Owner:Default owner (there can be multiple owners)
Platfrom: Default platform
Env : Default environemt

(milestone=1 , env= if its not the default env display the other env here)
#print files relevant to milestone 1 under that plan under that chapter
(milestone=2 , env= if its not the default env display the other env here)
(milestone=3 , env= if its not the default env display the other env here)
(milestone=4 , env= if its not the default env display the other env here)

If a plan has multiple chapters, it should print out multiple similar output for all chapters.
And it shoul depict change in environement, owner or platform in the milestone brackets.

Btw i'm sorting the data in excel and accessing an excel file. So first i dump the data in excel sort it and then access it. So everything is in an order.

Any help would be appreciated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

erum87Author Commented:
I need to create hashes of hashes for this. Something like $hash{$plan}{$chap}{$mlst}{$env}.....
Do you have a question about creating $hash{$plan}{$chap}{$mlst}{$env}?
Is it not working the way you expect?
erum87Author Commented:
Well i have issues with creating a hash, yes.
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

erum87Author Commented:
And then also using it in foreach since it has so many layers to it
What issues are you having?
erum87Author Commented:
lets start with creating a multilayer hash. Do i need to declare it. If yes then how do i make it loop through plan first and within that plan, all the chapters and within that chapter all the testnames as per wrt milestones and environments.
foreach $plan ( keys %hash ){
     foreach $chap ( keys %{$hash{$plan}} ){
          foreach $mist ( keys %{$hash{$plan}{$chap}} ){
                 foreach $env ( keys %{$hash{$plan}{$chap}{$mlst}} ){
                        print "\$hash{$plan}{$chap}{$mlst}{$env} = $hash{$plan}{$chap}{$mlst}{$env}\n";

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
You do not need to declare it.
erum87Author Commented:
Thanks :)
Another doubt
i'm creating an array fro plan, chapter, milestone and then looping through it.
foreach $plan(@plan){
    foreach $chap(@chapter){
        foreach $mlst(@mlst){
(Do i include the hashes here ? )
erum87Author Commented:
And why did you create a hash reference in the print statement ?
If you already have the keys in arrays, then you don't need to get them from the hash
erum87Author Commented:
The reason i wanted to use hashes was tomake the keys unique, since there are multiple occurances of plan and chapters etc. So where do I declare it so that the hash can access it.
I did not create a hash reference in the print statement, I quoted the $ so it would print literally instead of interpolating a variable
You may want to declare
  my %hash;
  our %hash;
especially if you are under
  use strict refs;
erum87Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 500 points for ozo's comment #37803998
Assisted answer: 0 points for erum87's comment #37803988

for the following reason:

helped me understand how to really access and lp thru layers of hashes :)
erum87Author Commented:
want more solutions
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

From novice to tech pro — start learning today.