use strict; use warnings; use SQL::Abstract; my $sqla = SQL::Abstract->new; my @where = ( { status => 'Review' }, { status => [ 'Offered', 'Denied', 'Cancelled', 'Conditional Offer' ], sent_email => { '!=' => [ -and => undef, '0000-00-00' ] }, }, ); my ( $sql, @bind ) = $sqla->where( \@where ); say $sql; say for @bind; __END__ #### perl 1206574.pl WHERE ( ( status = ? OR ( ( sent_email IS NOT NULL AND sent_email != ? ) AND ( status = ? OR status = ? OR status = ? OR status = ? ) ) ) ) Review 0000-00-00 Offered Denied Cancelled Conditional Offer #### $schema->resultset( 'TblRequests' )->search([ { status => 'Review' }, { status => [ 'Offered', 'Denied', 'Cancelled', 'Conditional Offer' ], sent_email => { '!=' => [ -and => undef, '0000-00-00' ] }, }, ]);