$ perl -E 'my $re = qr{([0-6BS])}; my %x = ($re, 1); my @y = keys %x; say $y[0]' (?^u:([0-6BS]))