Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

comment on

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

I am going to approach question from a different angle.
I am going to assume by "would then be accessed as" and by "Is there an easier, more efficient way to do this?" you may be talking about interface more then performance.

"accessed as" wreaks of api, as does 'easier'. I'm going to imagine that efficient means you want to be able to remain efficient in your job as in you don't want to go insane in 6 months- and create something important that only you know how to use...

I smell poop here.
Perl Object Oriented Programming.

I am trying to suggest that.. let your code be all nuts and creepy.. but.. provide an object oriented interface. Then later on you can worry about the innards and not change the interface.

Wouldn't it be nicer to interact with ...

use Seismic; my $s = new Seismic; my $lines = $s->lines; my $line0 = $s->line(0); my $line1 = $lines->[1]; my $stations = $line0->stations; my $station0 = $stations->[0]; my $station1 = $s->line(0)->station(1); my $x = $station0->easting; my $y = $station0->northing; my $z = $station0->elevation; my ($x,$y,$z) = $station1->xyz;

You can then rearrange your code, change your hash hierarchy, and it won't change your scripts using it, etc!

I've done some crazy hash stuff like this before- and looking back, this is stuff that's a nightmare to maintain interaction with. The interface really should be separated from the innards.

This is what OO is for, this is what computers are for, not people, imho.

Putting the extra week or two to learn some OO and implement it here- will save you countless hours later.

In reply to Re: Data Structures by leocharre
in thread Data Structures by YYCseismic

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?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (6)
    As of 2021-04-21 05:58 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found