You can simplify the calls to the anonymous subroutines. ...
Thank you for your comment, Jim.
And, yes, I wanted to write something like that, and that the reason why I built references to anonymous subs in the first place, rather than simple named functions. But for some reason, I got something wrong in the syntax for calling the subs in cmpthese, I am not sure to remember exactly, but I think I first did something like:
which gave compile errors. The first quick way I found to make it work was to wrap the function call in a sub block like this:regex1 => $regex1->(),
I realize that this is not the most elegant construct, but once it worked, I was happy enough to get my results and I was too tired, at around 2 a.m., to spend more time investigating further how to simplify the calls.regex1 => sub {$regex1->()},
And yes, I was sort of expecting unpack() to be faster, but it is still better to try it to be sure.
In reply to Re^3: Performance problems on splitting long strings
by Laurent_R
in thread Performance problems on splitting long strings
by Laurent_R
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |