I can access my Data Structure

I have this data structure:

%MEN =(
     pub => {
      level => '3',
      sub => ["Apostilas", "Papers","Libros"],
      subsub =>["1998","1999","2000"],
    },
   );

And this other:
%pubi = (
      level => '3',
      sub => ["Apostilas", "Papers","Libros"],
      subsub =>["1998","1999","2000"],
    );

I need :
1)To print all the elements of array subsub[]
2)Add news leemnts to this array

My problem is:
That I cannot to access this array.
I have tried this:

    foreach $var (keys %MEN){
      if ($var eq $menu) {
          for $rol (keys %{ $MEN{$var} }) {
            if ($rol eq "sub"){
                print "$rol = $MEN{$var}{$rol}[2]"; #this work, print the 3dr element, but I need all the elements
                                          #without knowing the number of elements
                    for ($i=0;$i<5;$i++){           #thniking that there is no more of 5 elements :)
                  print $MEN->{$var}{$rol}[$i]; # Dont work :((
                  }
            }
          }
      }
    }

The same with the other structure:
for ($i=0;$i<=5;$i++){
    print $pubi->{sub}[$i]; #DONT work....
}

How can I to acces this elements of the array?
How can I to add an new element?

Thanks in advanced!!!
hakimusAsked:
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.

Kim RyanIT ConsultantCommented:
# get anonymous array reference
$array_ref = \@{ $MEN{pub}{subsub} };
print(@$array_ref,"\n");
# push to dereferenced array
push(@$array_ref, '2001');
# value added!
print($MEN{pub}{subsub}[3]);
0
hakimusAuthor Commented:
This is working good....by now :)
Thanks!!
0
Kim RyanIT ConsultantCommented:
If this does want you want, you may like to accept this comment as the answer so the question can be closed off(and I can get some points :)
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Kim RyanIT ConsultantCommented:
# get anonymous array reference
$array_ref = \@{ $MEN{pub}{subsub} };
print(@$array_ref,"\n");
# push to dereferenced array
push(@$array_ref, '2001');
# value added!
print($MEN{pub}{subsub}[3]);
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
ozoCommented:
push @{$MEN{pub}{subsub}},2001;
print "@{$MEN{pub}{subsub}}\n";
0
hakimusAuthor Commented:
well, I still am doing some tests :)
Anything i will return with more questions (and points for the answers)
0
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.