The braces around the first BEGIN and END block are to limit the scope of use autodie; - is that right and is that 'all' they are doing?

Not quite all. They are also supplying scope for the two my-variables, so that they will only be accessible by that BEGIN and END block.

I can see what print {$fh} ($memory =~ s/^/$prefix/gmr); is doing but could not write it from scratch! The braces are needed because the thing that is printed is being calculated on the fly instead of being a constant or intopolated from a variable - is that right?

The braces are not needed around $fh. I just got in the habit of using the braces because more complicated filehandle expressions, like $structure{FH}, do require the braces, as described in print. Plus it helps me visually see that the print is going somewhere other than STDOUT. I don't always do that, but I try to usually do it. And the parentheses aren't required either -- but again, I used them for my own readability. AFAICT, print $fh $memory =~ s/^/$prefix/gmr; should work just as well -- though looking at it tells me I much prefer the extra syntax I used before, for personal readability.

And writing it from scratch wasn't intuitive for me, either: I am new to the non-destructive substitution, so I had to build up to it to make sure I was confident it did what I thought it would.


In reply to Re^4: Errors uncaught by CGI::Carp by pryrt
in thread Errors uncaught by CGI::Carp by Bod

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.