Edit: It's late here! I'll try again. Having read the rest of the thread now, I see that this was written because there was no nh tag on the category pages - however, I think there is now. So you should be able to replace all this code:
$name =~ s/\//\: /g;
$name =~ s/$name/$name: Page /g;
my $page = $tags->{title};
$page =~ s/$name//g;
and use this instead
Code:
my $name = $tags->{Full_Name}; $name =~ s/\//\: /g;
$name =~ s/$name/$name: Page /g;
my $page = $tags->{title};
$page =~ s/$name//g;
and use this instead
Code:
my $page = (ref $tags->{nh} ? ${$tags->{nh}} : $tags->{nh}) || 1;