You could simply exclude the opening parenthesis from the page capture
and the closing parenthesis from the section capture like so:
/^([^(]+)\(([^)]*)/
Here's a test with your four examples:
$ perl -E '
my @manpages = qw{
ftpd(8)
dhcp-config(5)
Cache::Cache(3)
Tk::widget::demo(3)
};
for my $line (@manpages) {
my ($page , $section) = $line =~ /^([^(]+)\(([^)]*)/;
say "page[$page] section[$section]";
}
'
page[ftpd] section[8]
page[dhcp-config] section[5]
page[Cache::Cache] section[3]
page[Tk::widget::demo] section[3]