in reply to Getopt::Long problem

You say:

i know that if a user uses " " around a string "function(key => './path')" it will work, but the user shouldn't care about anything except the way to properly write its string.

If the user "shouldn't care about anything except" the exact typing of the string, then the user should not be using the shell command line to do this.

Provide some other input method -- not a shell command parameter -- for the user to supply this complicated string; e.g. read it from a file or from stdin/pipeline, or put up a quick/easy Tk window with a text entry widget, and get the string without it having to pass through the shell's command-line interpreter.