Additionally use
Devedl-ptkdb to debug your code.
This will save you from coding related heartburn, headache...
If you are running perl on windows it is very easy to install this module.
At the command prompt:
ppm install Tk (which is required to run the debug tool)
...
ppm install Devel-ptkdb
Invoke the debug tool by typying:
perl -d:ptkdb my_script.pl