in reply to A (non) reg-ex question
If you already know that $_ contains '0' and '1' chars only:
else:tr/0// == tr/1// and index $_, '10' < 0
or justmy $hl = (1+length) >> 1; tr/0// == $hl and tr/1// == $hl and index $_, '10' < 0
/^(0*)(1*)$/ and length $1 == length $2
what if I only wanted the number of 0s and the number of 1s to be equal?
tr/0// == tr/1//
|
---|