Reputation: 1483
I'm trying to make a loop that stops when the length of @arr1
and @arr2
are both zero. I get this warning message
Useless use of private array in void context
when I use this
while (scalar (@arr1, @arr2) ) {
#more code
}
Why do I get a warning?
Upvotes: 3
Views: 452
Reputation: 242103
scalar
takes one argument. You have to use a bit more complicated
while (scalar @arr1 or scalar @arr2)
which is fortunately equivalent to shorter
while (@arr1 or @arr2)
Upvotes: 7