Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Parsing a Tree to a Table.

by Discipulus (Priest)
on Dec 10, 2013 at 11:13 UTC ( #1066413=note: print w/ replies, xml ) Need Help??


in reply to Parsing a Tree to a Table.

just a convoluted tree prettyfication

use warnings; use strict; my @tab; while(my $l = readline (*DATA) ) { @{$tab[$.-1]}= split '',$l ; foreach my $i (0..$#{$tab[$.-1]}) { unless ($. == 1) { ${$tab[$.-1]}[$i] =~ s/\|/${$tab[$.-2]}[$i +]/g if defined ${$tab[$.-2]}[$i] } } } foreach my $row (@tab) { print @{$row}; } __DATA__ A | |--B | | | |--C | | | |---PQR | |---XYZ |--D | | | |---LMN |---XYZ X |---000

cya
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.


Comment on Re: Parsing a Tree to a Table.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-07-04 15:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls