Hi,
I was testing my code written in Bro, and I was noticing some wrong values. When I debugged the code, the following section had the problem (the bold part)
if(vals[index2] == “length”){
local length_vals = split(vals[index2 + 1], /-/);
local lengths: set[count];
print cat("here - prev length = ", |lengths|);
for(index3 in length_vals)
if(length_vals[index3] != “”) add lengths[to_count(length_vals[index3])];
print |lengths|;
} #finished lengths
here is the output.
here - prev length = 0
1
here - prev length = 1
2
here - prev length = 2
3
here - prev length = 3
4
here - prev length = 4
31
here - prev length = 31
34
here - prev length = 34
46
here - prev length = 46
48
It means that whenever I declare local lengths: set[count]. It is not initializing a new ‘set’, but keeps the state of previous set of values entered and updated it. Why is it doing so?
regards,
Asma