{ my( $indent, $depth ) = ( "\t", 0 ); sub pp { my $flag; my( $pos1, $first ) = f1( $str ); if( defined $first ) { if( $first eq CONST1 ) { $pos1++; $depth++; } else { my $pos2 = f2( $str, $first ); if( defined $pos2 ) { $pos1 = $pos2 + 2; } else { $flag = 1; } } } print $indent x $depth, substr( $str, 0, $pos1 ); $str =~ s[^.{$pos1}\s*][]; $depth++ if $flag; return; } }