in reply to How to determine if an array contains an undef value?
By the way, in addition to the answers already given, a common pitfall:
sub foo { return } sub bar { return undef } my $a = foo(); # $x is undef, if($x) is false my @b = foo(); # @b is empty, if(@b) is false my $c = bar(); # $c is undef, if($c) is false my @d = bar(); # @d is (undef), if(@d) is true!!
because a return with no arguments is context-sensitive.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to determine if an array contains an undef value
by Anonymous Monk on Jan 04, 2015 at 18:22 UTC | |
|
Re^2: How to determine if an array contains an undef value?
by thanos1983 (Parson) on Jan 04, 2015 at 22:31 UTC | |
by locked_user sundialsvc4 (Abbot) on Jan 05, 2015 at 13:46 UTC | |
by Laurent_R (Canon) on Jan 05, 2015 at 22:11 UTC | |
by Anonymous Monk on Jan 05, 2015 at 22:23 UTC | |
by Laurent_R (Canon) on Jan 05, 2015 at 23:22 UTC | |
|