my $test; if (defined($test)) { print "test is defined"; } if ($test ne "") { print "test is defined again"; }