in reply to difference between my and local

The difference between local and my is that somewhat surprisingly the former doesn't really declare local variables! Oh but much better than I ever could you will find detailed explanations in the following two articles:

Oh, and a little self-ad on a related topic: Re: Are we seeing syntax inconsistency?