Add the following at the start of your script: #!/usr/bin/perl -w use strict; This will force you to be more careful with your variable names, and bugs will then lots of basic errors will become obvious. You are on Windows, so the path in the #! line above will be ignored, but the -w won't be.