in reply to Difference between 'my' and 'local'
broquaint wrote a very complete and interesting node about this subject : have a look at Lexical scoping like a fox.
A simpler explanation is to be found here : Variable Scoping in Perl: the basics.