in reply to Capturing Text from a die command
Note that if you want to capture the warnings, use $SIG{__WARN__}.