go ahead... be a heretic | |
PerlMonks |
Re: Re: Number of bits, length of RegExpby diotalevi (Canon) |
on Apr 21, 2003 at 14:58 UTC ( [id://252020]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|