Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Parsing a Tree to a Table.

by BrowserUk (Pope)
on Dec 10, 2013 at 10:21 UTC ( #1066409=note: print w/replies, xml ) Need Help??

in reply to Parsing a Tree to a Table.

For fun.

#! perl -slw use strict; my @a; my $last = 0; while( <DATA> ) { m[(^[^A-Z]+)?([A-Z]+)] or next; my $l = length( $1//'' ); if( @a and $l <= $last ) { print join "\t", @a; pop @a for 1 .. ($last-$l+3)/3; } push @a, $2; $last = $l; } print join "\t", @a; __DATA__ A | |--B | | | |--C | | | |---PQR | |---XYZ |--D | | | |---LMN |---XYZ

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1066409]
and the voices are still...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2017-10-18 20:36 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (250 votes). Check out past polls.