If this is the code you tried to run as D:\...\exec.pl, then that is your problem. This code is the module definition for Tk::ExecuteCommand. It cannot be executed by itself. Forget about trying to run it. If you are on windows, use ppm to install the module from one of the repositories and test it with the example code I have already posted.