Well, let's back up a minute and talk about your DC wiring system. On a simple boat straight from the factory, what you often have are two batteries. Both negatives are tied together and from there go to the main DC panel and the starter ground lug. One battery's positive is connected to the #1 position on the Perko switch and the other positive is connected to the #2 postion. You probably also have critical systems like bilge pumps directly wired to one of the batteries with a fuse near the battery. The common side of the Perko switch goes to the house panel and to the engine starter.
So, does this describe your system accurately?
If so then the Perko switch is used to isolate one of the batteries so that you can use it on the hook to power the house loads and then even if that battery is run down, you can switch to the other battery and start the engine.
If you wire anything such as a solar panel directly to both battery positives, you defeat the purpose of the Perko switch and both batteries can run down simultaneously while on the hook, leaving you with no battery starting capability.
So, assuming that both batteries are the same size and type, then designate one as house and the other as the starting battery. It would even be good to put a label on the Perko switch to that effect. Then wire the solar panel to the common terminal of the Perko switch. Or even better still wire it to the output side of your DC panel breaker like the one that feeds the cigarette lighter output. The solar panel will back feed to the battery through that breaker. That way you can use that breaker to protect the wire to the solar panel. You just have to use a wire size that matches the breaker rating- 14 gauge or 15 amps and 12 gauge for 20 amps.
Then leave your Perko switch on all so it keeps both batteries charged. Then when you get to an anchorage switch it to the house bank to protect the starting battery.
Sorry for the long winded explanation. The bottom line is wire the solar output to the common terminal of the Perko switch and keep it set to all to charge both batteries while not in use.