in reply to "my" variable masks earlier declaration in same scope

You'll probably find Coping with Scoping by Dominus worth reading. Pay particular attention to the section called "Lexical Variables".
  • Comment on Re: "my" variable masks earlier declaration in same scope