I am not an expert, but I did take some related training classes. As I understand it, you need to attach a callback to the button that will invoke your script. It looks like the callback in that GUI is called "CUSTOM::setOKCallback". The reference page for it is at
It directs you to a longer example that shows changing a runset value. Instead of doing that, your bit of code should call the perl script. You may need to add the perl libraries and executable to your PATH settings for Calibre to be aware of the perl installation, depending on your setup.
The CUSTOM::setOKCallback command is going to set a callback for the OK button on the customization GUI - perhaps that will work for what you want? - Kim