Casting int to bool may be undefined (atleast prior to C99).

If a compiler/platform does not have a boolean type, Perl will define
it. We cannot assume that the actual underlying type supports conversion
to and from integers i.e. it may be defined as a struct.
The size of an array declared on the stack should be known at compile time (pre C99)

Create the array on the heap to circumvent this restriction.