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 (Abbot) 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   200         Y           685  XYZ12345-s12345
    dnsname2               Y           635  XYZ67891-s67890

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

Re^3: Store multiple lines
by hippo (Chancellor) 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).