while (my $cond = shift) { $filter = "($op $filter $cond)" if defined $cond; }
The while conditional will exit the loop if $cond is false or undefined so the subsequent test for defined is redundant, $cond will not be undefined inside the loop. Note that if $cond also contains "0" or "" it will exit the loop.
In reply to Re: Generating complex LDAP queries with Perl
by jwkrahn
in thread Generating complex LDAP queries with Perl
by grinder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |