The advantage of perl's notation is that it is consistent and, with practice, it tells you everything about the structure above the data.

The usual way to make that briefer would be to make a real data accessor,

sub cost { my ($self, $location, $b) = @_; $self->{Locations}{$location}{Buildings}{$b}{cost}; } # . . . my $cost = $h->cost($location, $b)
where the cost method is defined in the namespace of the $h object.

It probably would help to break the big data structure into subobjects to which the whole has a 'has-a' relation.

I agree that big deep data structures full of bits of everything are awkward to handle. I don't think notation is the real problem. It's a design matter.

After Compline,
Zaxo


In reply to Re: Dotted hash access by Zaxo
in thread Dotted hash access by sfink

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.