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.