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

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??

For folding it doesn't matter if the below is folded recursively. It is more important for unfolding. It allows you to unfold an entire sub, or just the single level.


sub abc { my ($x) = @_; my $z; foreach my $y (@{ $x }) { # do xxx # on # lots # of # lines } return $z; }

when it is folded it would be (kinda like this in vim)

+-- 14 lines: sub abc {

when you unfold, would you get back the initial example, or

sub abc { my ($x) = @_; my $z; +--- 7 lines: foreach my $y (@{ $x }) { return $z; }

That is the purpose of recursive folding IMHO.

In Vim, it remembers the folded status of things, so if it is in the first example and you fold to the second example, when you unfold, it goes back to the first example. However, if you fold recursively, the default unfold will unfold to the third example.


In reply to Re: Code Folding by afresh1
in thread Code Folding by sir_lichtkind

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.