use 'my' in while and foreach loop