my $val1 = $next_cell_arr[0] || die "val1 is undefined!!\n"; #### use strict; my $val1; # this creates a named storage location for a scalar value, # but DOES NOT ASSIGN A VALUE -- its value is undefined. my $val2 = 0; # creates a named scalar and assigns a value, so it's defined # but the value will evaluate to FALSE in a # boolean sense my $val3 = ''; # similar to $val2: it's defined, it evaluates to false # in boolean tests, but in "reality", it's an # "empty string" (which $val2 is not) print "val3 is an empty string\n" if ( $val3 eq '' ); print "val2 is an empty string\n" if ( $val2 eq '' ); print "val1 is (like) an empty string\n" if ( $val1 eq ''); # this third test would generate a warning in "perl -w" my $i = 1; for ( $val1, $val2, $val3 ) { print "val$i evaluates to false\n" if ( ! $_ ); print "val$i is undefined\n" if ( ! defined( $_ )); $i++; }