#!/usr/bin/perl use strict; use warnings; my $x; my $y; if ($y) { } if (! $y) { } if ($y && ! $y) { } if (exists $x->{notdef}) { } if (defined $x->{notdef}) { } if ($x->{notdef}) { } print ref $x, "\n"; print "\$y is undef\n" if ! defined $y; if (exists $x->{notdef}{notdeftoo}) {} print "Now \$x->{notdef} exists\n" if exists $x->{notdef}; #### HASH $y is undef Now $x->{notdef} exists