in reply to Benchmarking regexes

Without having read the rest of your post:
With the sub:
(Output = Alternation takes 0.000 seconds. Character class 0.001 seconds. )

I hope you didn't draw any conclusions from this "result"? It's clear that accuracy of your time measurement and/or output is too low to give you any gain in knowledge. If one of the values is there and the other is only one digit, you didn't really measure anything.

I'd recommend to use Benchmark, which adjusts the repetition counts if the accuracy is too low.

Replies are listed 'Best First'.
Re^2: Benchmarking regexes
by Anonymous Monk on Mar 17, 2009 at 23:50 UTC

    Thank you for your quick reply.

    No worries, no conclusions have been made, I was wondering why moving the test into a subroutine produces the second result instead of the first. I was planning on running quite a few examples and was hoping to minimize the amount of code by creating the subroutine test, but it isn't working as I hoped...