in reply to I need a simple explantion of the difference between my() and local()
From perldoc perlfaq7:
What's the difference between dynamic and lexical (static) scoping? Between local() and my()?local($x) saves away the old value of the global variable $x, and assigns a new value for the duration of the subroutine, which is visible in other functions called from that subroutine.
...
my($x) creates a new variable that is only visible in the current subroutine.
In Section
Seekers of Perl Wisdom