in reply to A (non) reg-ex question

How could we match the language 0{n}1{n}?

If you already know that $_ contains '0' and '1' chars only:

tr/0// == tr/1// and index $_, '10' < 0
else:
my $hl = (1+length) >> 1; tr/0// == $hl and tr/1// == $hl and index $_, '10' < 0
or just
/^(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//