I have been researching of late... having to have had use "bad" languages such as Java.
Basically, what I want to ask is if there is any language for the web that simplifies resource management similar to RAII?
By that I mean languages that don't force you to use some kind of try/catch/finally everywhere an exception might be thrown in order to force some resource closed (such as Java).

For example, say I have a database which needs to be closed, and some in between opening it.
Is there a mechanism in PHP/Perl/ASP/<name_your_language> to make sure the database always gets closed regardless if exceptions are thrown or not, without having to retort to some petty try/finally solution?