Thread Nummerierte Liste / Baum aus nested structure machen
(3 answers)
Opened by pktm at 2010-02-26 00:04
das könnte dann so aussehen:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 my @levels; while (my $row = $sth->fetchrow_hashref) { my $level = $row->{level}; $levels[$level]++; local $" = "."; print "@levels[0 .. $level] $row->{ident}\n"; } __END__ 1 root 1.1 a 1.1.1 b 1.2 c Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wie frage ich & perlintro brian's Leitfaden für jedes Perl-Problem |