Ok, So I'm trying to run the following code but it says "Permission Denied" . Any idea why is that?

I personally believe that is sounds like a permission problem. I think it depends on you not having the permission to read some particular file. It's your business, and having nothing to do with the code.

For my understanding, what it does is printing the file with line numbers, then activating "process_para" if matching empty line. It seems to me like the subroutine is processing only one line, isn't it?

I personally believe that your understading is severely flawed. The program does nothing like "printing the file with line numbers" but it has a commented out line which would print the file with the nesting level of parens prepended to lines. It also does nothing like "activating" (whatever that may mean) process_para() is matching an empty line: it calls it on what you call a "paragraph" if the indenting level becomes null, which is the means it adopts to slurp in a "paragraph." What do you think that the

$buf .= $_;

line does?

--
If you can't understand the incipit, then please check the IPB Campaign.

In reply to Re^3: Substitute in a subparagraph by blazar
in thread Substitute in a subparagraph by guyov1

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.