Ok, for testing purposes, I added Exporter to it and ran it off my computer. Now it does what I mentioned before where it runs fine one out of every few tries, but errors the others.
I don't care if it uses a var or sub, the sub results are going to end up being stored on a var anyway. I just want to gettimeofday at the begining and the end of my scripts without needing to add the code on each script and without using modules. It works fine if I declare the variable within the main script. Everything else is either not working at all, or working 1/4 of the time.