I have an array with an undefined value:
[0] 0.1431,
[1] undef
I then later push this value onto an array, and Perl doesn't warn me about the uninitialized values (I cannot imagine why someone would want this to happen without a warning or die, even when I have use autodie ':all' set, but that's another story)
So I try and grep on these arrays to prevent pushing undef values onto arrays, thus:
if (grep {undef} @array) {
next
}
But, this doesn't catch the value.
How can I grep for undefined values in Perl5?
undefdoesn't check if something is undefined; it makes things undefined and/or returns an undefined scalar (depending on how it's used)use autodie ':all'set",pushcan't fail, so the concept of making itdieon failure makes no sense.next unless defined $var;