Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Do you have a favorite "Accessing Data in Nested Structures for Complete Idiots" tutorial

Bad question. Don't access data in a nested structure. Access the data you have at hand.

One would access the countries in a list of counties as follows:

for my $country_name (keys(%$countries)) { my $country = $countries->{$country_name}; ... }

One would access the provinces in a list of provinces as follows:

for my $province_name (keys(%$provinces)) { my $province = $provinces->{$province_name}; ... }

Maybe $provinces is the same as $country or $country->{provinces} or $country->get_provinces(). Does it matter? No.

for my $country_name (keys(%$countries)) { my $country = $countries->{$country_name}; my $provinces = $country->{provinces}; for my $province_name (keys(%$provinces)) { my $province = $provinces->{$province_name}; ... } }

In reply to Re: Nested Data Structures for Dummies? by ikegami
in thread Nested Data Structures for Dummies? by jedikaiti

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [Your Mother]: :P
    [ambrus]: YourMother: my brother told me their cat wants to climb into the dishwasher if they leave the door open. Not when the dishwasher is started, but after it's done washing, because it's still warm and cats like warm.

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (12)
    As of 2017-12-18 15:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      What programming language do you hate the most?




















      Results (491 votes). Check out past polls.

      Notices?