in reply to Regexp for Match Brackets

If all you want to do is test for an equal number of '(' and ')' then this will do the trick:
use strict; my $text='(one dfd(two(three)four()(five)df())df)'; print $text if (my @x = $text =~ m/\(/g) == (my @y = $text =~ m/\)/g);
This counts up the number of '(' and the number of ')' and prints $text if the counts equal.

Note: this doesn't test if the brackets are balanced! $text=')()(()' would match just as easily as $text='((()))'

Also, I don't think using $& is a good idea for this problem.