Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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.
Comment on Re: Parsing a Tree to a Table.
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1066409]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2016-05-03 17:35 GMT
Find Nodes?
    Voting Booth?