There are a lot of Getopt modules. The following are some that will just slurp everything into a hash like you desire:
I personally would never do something like this though, and have no real world experience with any of these modules. I'd always aim to validate every script for both error checking and as a means to self-document what the script is doing and uses.