use warnings; ... if (defined($x) && length($x)) { ... }