I have found that there is the module Error that provides try and catch functionality like in java. But I am confused at how you can print the exception that returns.
I
You're probably better off using Try::Tiny which will help you avoid a number of pitfalls with older perls.
use Try::Tiny; try { die "foo"; } catch { warn "caught error: $_"; };