Perl uses reference counting so when your object goes out of scope or the references are explicitly undefed then it calls the object's destructor.
Of course when the resource is reclaimed is variable.
But for the object to be destructed reference counting must reach 0.
Bottom line is, when you use a Perl module, destrcution is handled by Perl automatically.The problem is when you call 'unmanaged' resources, for example calling a C++ dll.
There you have to follow the API's documentation on how to release the resourcse,explictly