# the scalar of an array is its number of elements if ( scalar(@array) ) { ... } # or equivalently, and shorter # exactly the same thing, since 'if ()' forces scalar context if ( @array ) { ... }