use strict; use warnings; my $scalar; # starts empty ie undef # IF THEN ELSE print "\$scalar now holds the following value: [", $scalar ? $scalar : 'UNDEF',"]\n"; # oops more correct as afoken pointed below: print "\$scalar now holds the following value: [", defined $scalar ? $scalar : 'UNDEF',"]\n"; # update: # infact, unless you check with 'defined' a zero can mislead you: $scalar = 0; print "\$scalar now holds the following value: [", $scalar ? $scalar : 'UNDEF',"]\n"; print "\$scalar now holds the following value: [", defined $scalar ? $scalar : 'UNDEF',"]\n";