in reply to Re: Using qw to check for balanced parentheses
in thread Using qw to check for balanced parentheses

I may be mistaken, but this does not detect a case like "}a{" , or does it? how about
sub balanced { (my $s = shift) =~ s/[^()]//g; while ( $s =~s /\(\)// ){}; return $s ? 0 : 1; }
? It may be slower, but detects ')(' as incorrect