sometimes i'm not too confident handling properly all the cases in multiline (and especially nested) records. if you know or can learn awk (very easy to learn), it's much better at this sort of stuff. with awk you can nest matches to particular levels and each level loop keeps its place properly. it's pretty neat. there's probably perl module or two to parse multiline records. crafting it on your own with a regex can sometimes end up inadvertantly not processing some data that was meant to be processed. anyway, there should still be the built-in automatic converter from awk scripts into perl in your perl distribution.
that's just alternative to what you may be already doing, so my pick of the best horse may not be the same as yours.
the hardest line to type correctly is: stty erase ^H