The definition of your hash has quite a few problems, such as missing comma, missing end }, misusing = where needs =>. Also top level "Projects" is useless, unless you have something else at the same level (which you didn't show)

Here is an example as how you can go through subcomponents of softwares:

use Data::Dumper; use strict; use warnings; my %projects = ( Projects => { "Project1" => { version => "3.41", status => "nul", components => { "Software" => { name => "controller", label => "RC_1.01", subComponents => { "Database" => { version => "1.01", }, "SerialComms" => { version => "2.13", } } }, "Firmware" => { name => "I/O Interface", label => "RC_1.21", } } }, "Project2" => { }, "Project3" => { } } ); for my $project_key (keys(%{$projects{"Projects"}})) { print "$project_key:\n"; my $project = $projects{"Projects"}->{$project_key};#this looks no +t necessary here, but in more complex code, it does help to simplify +things if (defined($project->{"components"}{"Software"})) { for my $subcomponents_key (keys(%{$project->{"components"}{"So +ftware"}{"subComponents"}})) { print $subcomponents_key, ":\n"; print Dumper($project->{"components"}{"Software"}{"subComp +onents"}{$subcomponents_key}); } } }

this gives:

Project3: Project1: Database: $VAR1 = { 'version' => '1.01' }; SerialComms: $VAR1 = { 'version' => '2.13' }; Project2:

In reply to Re: Accessing multi-level hashes by pg
in thread Accessing multi-level hashes by carcassonne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.