Above data structure you can easily be traversed with three nested while loops applying each .

my $VAR1 = { '99155' => { 'PR' => { state_name => 'Puerto Rico', county_names_all => 'Adjuntas|Utuado', }, }, }; my $v0 = $VAR1; while ( my ($k1,$v1) = each %$v0 ) { while ( my ($k2,$v2) = each %$v1 ) { while ( my ($k3,$v3) = each %$v2 ) { print "\$VAR1->{$k1}{$k2}{$k3} => '$v3'\n" } } }

output

$VAR1->{99155}{PR}{state_name} => 'Puerto Rico' $VAR1->{99155}{PR}{county_names_all} => 'Adjuntas|Utuado'

Since your third level is an array you'll have to split it up into a hash.

my $v2 = [ 'state_name=Puerto Rico', 'county_names_all=Adjuntas|Utuado', ]; my %h3 = map { split /=/,$_,2 } @$v2; print Dumper \%h3;

$VAR1 = { 'state_name' => 'Puerto Rico', 'county_names_all' => 'Adjuntas|Utuado' };

This should give you enough hints. :)

HTH!

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

update

on a side note, you can also use each on arrays

my $v2 = [ 'state_name=Puerto Rico', 'county_names_all=Adjuntas|Utuado', ]; while ( my ($k3,$v3) = each @$v2 ) { print "\$v2->[$k3] => '$v3'\n" }
out
$v2->[0] => 'state_name=Puerto Rico' $v2->[1] => 'county_names_all=Adjuntas|Utuado'

In reply to Re^2: Get all hash value into array (while/each) by LanX
in thread Get all hash value into array by Magnolia25

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.