my $y; if (defined $y) { print "Y is defined\n"; } else { print "Y is not defined\n"; } if ($y eq "") { print "Y is null string\n"; } else { print "Y is not null string\n"; }