Also, depending on how @array is actually populated, some elements may be undefined, which perl also treats as false, and throws a warning (if use warnings is in effect) if you try to do anything with it...
Use of uninitialized value in concatenation (.) or string at test2.pl
+line 15.
perl considers the string:--><-- to be false.