I've been programming in half a dozen languages for some time now and I recently picked up perl. I have no formal training in perl so forgive my ignorance if this question sounds stupid. My question concerns the use of "my" when defining variables. In all the perl programs I've written I never used "my" for anything. I assume it's a way of defining local variables that are not available outside the local environment. What is the purpose of defining local variables like this? And... should I be doing this?
Once you waste a few good hours debugging your software only to find out that bug was due to local variable with the same name as global, thus masking global var's value that you actually needed, you will appreciate necessity to always "use strict" in Perl, and therefore use "my" to declare variables explicitly.