But what about close? I mean, I know *when* it happens: when $fh goes out of scope. That's the point if this construct. But how does it happen, in terms of error catching? I almost always want to handle errors on close. How do I express that using this syntax? (Where do I hook up my "or die"?)
Honestly, I'd do it explicitly. Depending on scoping rules for resource management isn't exactly the most obvious WTDI, although the bare block does make the point pretty well. Putting in an explicit close $fh or die "close: $!"; lets everyone reading your code know that, yes, you have thought about it, and dealt with it as you saw fit -- that you didn't forget to do something clever if close failed.
(On the other hand, I've never actually had close fail. Not that that's an excuse for not checking a system call's return value, of course. :-)
Found a typo in this node? /msg me
% man 3 strfry