sub do_file($$){ my ($file, $indent) = @_; local *FOO; open(FOO, $file); while () { /^(\t+)#&#(.+)/ && $indent = do_file($2, $indent + length $1); print; } close FOO; return $indent; }