- or download this
sub is_abc {
local $_ = shift || $_;
$_ !~ /[^abc]/
...
local $_ = shift || $_;
$_ !~ /[^ab]/
}
- or download this
sub has_odd_ab {
local $_ = shift || $_;
my $n = () = /ab/g; # count matches
1 & $n # odd?
}
- or download this
sub odd_a {
local $_ = shift || $_;
1 & tr/a//;
...
local $_ = shift || $_;
1 & tr/b//;
}
- or download this
sub prob_one {
local $_ = shift || $_;
is_abc and has_odd_ab;
...
local $_ = shift || $_;
is_ab and ! odd_a or odd_b;
}