##
if ( scalar @{ $lib || [] } ) {
...
}
####
$ perl -Mstrict -E 'my $aref = [ "", undef ]; say scalar @{ $aref || [] } ? "True" : "False";'
True
####
$ perl -Mstrict -E 'my $aref = [ "", undef ]; say scalar ( grep { length $_ } @{ $aref || [] } ) ? "True" : "False";'
False