I am writing scripts where I have to pass or fail a test case. So I have some value in a variable which is coming out to be undef.
I am checking something like this:
I have a $val
in which there are array of hashes. Now I am checking if that array is empty:
if(@$val<=0){do something}
So if that $val = undef
, then this throws an error:
Can't use an undefined value as an ARRAY reference
How should I check if my $val
is empty?