if( ( $flag1 or $flag2 ) and ( length( $string ) ) { # ... }