in reply to Regex combining /(foo|bar)/ slower than using foreach (/foo/,/bar/) ???  

Hi, I think the problem is with this line.
my $regex = qr /(?:$regexstr)/;
because perl compiles this patern again & again in the foreach loop.
foreach my $stringlength (100,1000,10000,100000)
If you use this pattern
my $regex = qr /(?:$regexstr)/o;
instead of
my $regex = qr /(?:$regexstr)/;
It will be fast. Since it compiles the pattern only once.