Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Store multiple lines

by bartrad (Acolyte)
on Feb 09, 2018 at 13:27 UTC ( #1208823=note: print w/replies, xml ) Need Help??


in reply to Re: Store multiple lines
in thread Store multiple lines

Thanks for your help! As you can probably tell, I'm learning as I go and certainly appreciating the more than one way to do things in Perl. I think what I'm more interested in is actually the best way to do it. Appreciate you've called out the method is messy, and I have to agree. Could I ask possibly how you would do it please?

Replies are listed 'Best First'.
Re^3: Store multiple lines
by poj (Monsignor) on Feb 09, 2018 at 13:52 UTC

    It might be simplified depending on relationships between the data columns. For example, if the data was arranged as a table like this

    dnsname   static-route  next-hop  preference  bfd-enable  tag  service-name 
    dnsname1  1.1.1.1/30    2.2.2.2   200         Y           685  XYZ12345-s12345
    dnsname2  3.3.3.3/30    4.4.4.4               Y           635  XYZ67891-s67890
    

    Would the first 2 (or 3) columns uniquely define a single row in the table ?

    poj
Re^3: Store multiple lines
by hippo (Abbot) on Feb 09, 2018 at 14:14 UTC

    Good question! It rather depends on the properties of your data and how you want it structured. I guess that each "service-name" is unique? You could then have a much flatter data structure if you just keyed on that. eg:

    • results
      • service name
        • dns
        • static
        • next hop
        • tag

    But maybe that's no use to you depending on how you would want to use the data later on. Once you know what most useful form the data should take you can go about constructing it (and that might even involve some pre-processing).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1208823]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-02-18 09:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (253 votes). Check out past polls.

    Notices?