in reply to (tye)Re: japhy regex analysis: case study (RE question...)
in thread RE question...yup, another one ;)

Except that you never actually stored anything in local $x.
use Benchmark 'cmpthese'; $x = int (1_000_000 * rand 1_000_000); cmpthese( -3, { mod => sub { $x % 10 }, chop => sub { local $x; chop $x }, chop2 => sub { chop(local $x = $x) }, }); __END__ Rate chop2 chop mod chop2 25430/s -- -88% -93% chop 204396/s 704% -- -41% mod 348051/s 1269% 70% --
On my machine, chop() was slower. But the real chop() approach was slower still.

japhy -- Perl and Regex Hacker