Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Complex Data Structure

by Neighbour (Friar)
on May 21, 2012 at 14:49 UTC ( #971636=note: print w/replies, xml ) Need Help??

in reply to Complex Data Structure

Well, by the looks of it, it's a hash (%Data) which references another hash (with keys Rank and Salary), which references an array (where you push your datasets into). Depending on what's *in* that dataset it could go on, but for now you have a hash-of-hashref-of-arrayref :)
You could make it more elegant and use a hashref to start with (so use $Data->{$Name} instead of $Data{$Name} and don't initialise it with my %Data but my $Data) in which case you'll end up with a hashref-of-hahref-of-arrayref (or HRHRAR :P)

As for the aestetics, there's a program for that (there usually is) called perltidy. It has more rules than you will initially care for, but once you've got your personally approved configuration set up, you can convert all perl codefiles that come your way to the layout you prefer.

Replies are listed 'Best First'.
Re^2: Complex Data Structure
by Anonymous Monk on May 21, 2012 at 14:52 UTC
    Great exactly what i was looking for. One thing - why should I initilise it with $Data and not %Data?

      No reason I'm aware of; just a matter of personal preference. I tend to use a hash variable rather than a hashref at the top level to save typing arrows ( $data{level1}{level2} instead of $data->{level1}{level2} ) unless it's a reference to an object or I'm going to be passing it as a reference to a lot of functions or something, in which case I'll save a little typing by passing $data instead of \%data. So it really just depends on how I'll be using it.

      Aaron B.
      Available for small or large Perl jobs; see my home node.

      Stupid question I get it.. Thanks

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971636]
[haukex]: You can put it in SOPW, but use <readmore> tags
[haukex]: Also you might want to label it "code review"
[haukex]: Unless you have specific questions, in which case SSCCE's are much better
[cbeckley]: Excellent, thank you.
[cbeckley]: CUFP is more appropriate for stuff that's finished^h^h^h^h more advanced state of completeness?

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2017-03-24 15:06 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (304 votes). Check out past polls.