in reply to getopts and -?

Many shells treat "?" specially, so you may have to use

script.pl -d -P MBKL107 -v name=fred '-?'

Now that you're actually passing it to the script, you can use Getopt::Long to parse your args. Great module, and it handles "-?".