in reply to Re: Number of bits, length of RegExp
in thread Number of bits, length of RegExp

I wouldn't have let tr delete anything - just count the number of ones and then test that number for oddness. So I'd say this as $is_odd = $foo =~ tr/1// & 1; $is_even = $foo =~ tr/1// ^ 1;. This only tests bit zero's value and in theory is speedy. I dunno if it actually is.

Replies are listed 'Best First'.
Re: Re: Re: Number of bits, length of RegExp
by Improv (Pilgrim) on Apr 21, 2003 at 15:02 UTC
    Out of academic curiosity, does anyone know if scalar construction is likely to be more or less expensive than scalar modification? As a matter of fact, it would be really interesting to see performance analyses of many common perl operations.. Maybe they're already out there.. Any pointers, anyone?