#!/usr/bin/perl -l use strict; my $x; print +($x eq '') ? 'Yes' : 'No'; #### #!/usr/bin/perl -l use strict; my $x; print +(defined $x && $x eq '') ? 'Yes' : 'No'; #### if ( (not defined $new and not defined $old) or (defined $new and defined $old and $old eq $new) ) { ... }