sub has_odd_ab { local $_ = shift || $_; my $n = () = /ab/g; # count matches 1 & $n # odd? }