On Thu, Jun 26, 2008 at 9:57 AM, Pat Rice <[EMAIL PROTECTED]> wrote: > Hi all > I'm wondering if there is a nice way to parse this data, as in is > there any module that could handle this type of data, as in the was it > is presented? so that I can repeat is itn a tree like structure in > HTML ? > > so I can pic out the tree like structure and replicate it in some way > so that I can put it in an array or into a database ?? so i could pick > out the data I want. > > \==+Interface : > |----Link State.........................................Down > \==+SCSI Interface : > |----Name............................................vmhba1 > |----Console Name....................................scsi1 > |----Queue Depth.....................................4096 > \==+PCI Device : > |----Bus..........................................0x0b > |----Slot.........................................0x00 > |----Function.....................................0x00 > \==+Scsi Stats : > |----Commands.....................................48632378 > |----Blocks Read..................................1862894689 > |----Blocks Written...............................858120919 > |----Aborts.......................................0 > > Thanks in advance > Pat
I'm thinking of representing each node as a hash of hashes... By counting the number of leading spaces you can check if the level changed. For lines starting ' +\|---' you add an element storing the key/value and for lines starting with a \==+ you change the current node to a new node. Needs some work... This makes me think of my C course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/