my creates lexical variables. When you use symbolic references (as in your foreach loop), you are referring to package variables. If you print $main::zero, etc. you will see the results of your assignments. Note that symbolic references are usually a bad thing, and you should almost always use strict.