my $re_str="qr{([0-6BS])}"; $_="B"; my $ans; if (eval m{$re_str})