Closed
Description
This script should print "true":
BEGIN
{
@[1] = 1;
@[2] = 2;
$count = len(@);
// Uncomment this line and it works
//$count = 2;
printf("count: %d\n", $count);
if ($count > 1) {
print("true");
} else {
print("false");
}
printf("count: %d\n", $count);
clear(@);
exit();
}
Output:
Attaching 1 probe...
count: 2
false
count: 2
We can see that $count
holds the value 2 (as expected), but this value does not evaluate as greater than 1 for some reason.
If we use the literal 2
instead of the result of len(@)
, then we get the expected result.