in reply to Can't detect Hash values that are empty
undef does not work the way you think it does:
if(undef($text)) { ...
This will always set a variable to undef. You likely want defined as in if( ! defined($text)) { ...:
foreach my $row (@{$data_all}) { say $row; my %currec = %{$row}; foreach my $columns (keys %currec) { my $text = $currec{$columns}; say $text; if(! defined ($text)) { say "$columns is NOT DEFINED"; } elsif (length($text) < 1) { say "$columns DEFINED, but empty"; } } exit; }
|
|---|