Yes, Perl closes logical operators. This means that they can be used for control flow:
say "foo" if $bar;
coincides with
$bar and say "foo";
and
if ($cond) { stuff() }
coincides with
$cond and do { stuff() }
However, the entire if condition must be wrapped in parens, creating your example
if ($do eq 'b' && /text/) { do stuff; }
( && same as and , but has a higher priority)
source share