Apart from warn you have other options carp,cloak confess
which gives full stack trace or minimal stack trace
You can also use a similiar thing as mentioned before
$DEBUG=1;
...
my $val = get_something("vars");
warn $val if ($DEBUG && ! $val);
But with a change istead of warn use mail which mails the errors to you alone instead of Showing it to entire world
:=)
Regards
P.B.Sathish Kumar