Note that if you want to capture the warnings, use $SIG{__WARN__}.
In reply to Re: Capturing Text from a die command by matija in thread Capturing Text from a die command by or10n