in reply to Re: complaint: always testing defined()
in thread complaint: always testing defined()
I would advice against using and in this context, because later someone (you) may add an innocent return ....
sub is_empty_string { my ($value) = @_; return defined $value and $value eq ''; }
I think && is more appropriate here:
sub is_empty_string { my ($value) = @_; return defined($value) && $value eq ''; }
|
|---|