I typically initialize variables explicitly to undef (as in my $var = undef;) if I cannot produce a meaningful initial value at that point in the program. If this is done, then the test to later determine if a value was produced is simply defined($var) and usually producing an undefined value is just as bad as producing no value, so die "..." unless defined($var); works well to bail out on error later.
And just a reminder, you are including use strict; and use warnings;, right?
In reply to Re: conditional print. Is correct to use it?
by jcb
in thread conditional print. Is correct to use it?
by pvaldes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |