in reply to Re: hash problem
in thread One liner to Check and undef hash elements
$hash->{'a'} = 1; $hash->{'b'} = undef; $hash->{'c'} = undef; $hash->{'d'} = undef; if (scalar grep {defined} values %{$hash} == 0) { print "empty\n"; } $hash->{'a'} = undef; $hash->{'b'} = undef; $hash->{'c'} = undef; $hash->{'d'} = undef; if (scalar grep {defined} values %{$hash} == 0) { print "empty\n"; }
|
|---|