in reply to Re^3: Is Text::RE::Foo a good name space?
in thread Is Text::RE::Foo a good name space?

alternations are slower, but tr is faster for simple expressions:
               Rate alternate    single        tr
alternate  631309/s        --      -80%      -86%
single    3198780/s      407%        --      -27%
tr        4411077/s      599%       38%        --
use Benchmark qw(cmpthese); cmpthese(-1, { alternate => \&alternate, single => \&single, tr => \&tr_op }); my $s; BEGIN{ $s = 'this is a string'; } sub alternate { return $s =~ /[a-b]|[c-d]|[e-f]/ ; } sub single { return $s =~ /[a-f]/; } sub tr_op { return $s =~ tr/a-f/a-f/; }