Re: parsing a tree like structure

2008-06-26 Thread Brad Baxter
On Jun 26, 9:57 am, [EMAIL PROTECTED] (Pat Rice) 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 pi

Re: parsing a tree like structure

2008-06-26 Thread Dr.Ruud
"Pat Rice" schreef: > 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 ? Maybe you are looking for something like this: #!/usr/bin

Re: parsing a tree like structure

2008-06-26 Thread yitzle
Sorry for the multiple replies... This code works. Though I think I might be doing something "bad". When I comment out the line: $curNode->{ $nodeName }{ '__PARENT__' } = $curNode; after the loop, %root is an empty hash. I'm not sure why. #!/usr/bin/perl use strict; use warnings; use Data::D

Re: parsing a tree like structure

2008-06-26 Thread yitzle
This code is a start. It needs some playing with, still. #!/usr/bin/perl use strict; use warnings; use Data::Dumper; open my $FH, "< t" or die; my %root = (); my $depth = 0; my $curNode = \%root; while ( my $line = <$FH> ) { chomp $line; $line =~ /^(\s*)/; my $leadingSpace = lengt

Re: parsing a tree like structure

2008-06-26 Thread yitzle
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 ? >

Re: parsing a tree like structure

2008-06-26 Thread Jeff Peng
On Thu, Jun 26, 2008 at 11:53 PM, Jeff Peng <[EMAIL PROTECTED]> wrote: > On Thu, Jun 26, 2008 at 9:57 PM, Pat Rice <[EMAIL PROTECTED]> wrote: >> >> \==+Interface : >>|Link State.Down >> \==+SCSI Interface : > > Is this the info in

Re: parsing a tree like structure

2008-06-26 Thread Jeff Peng
On Thu, Jun 26, 2008 at 9:57 PM, Pat Rice <[EMAIL PROTECTED]> wrote: > > \==+Interface : >|Link State.Down > \==+SCSI Interface : Is this the info in a text file? If so I think you must parse it by hand, after that you create the

parsing a tree like structure

2008-06-26 Thread Pat Rice
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