if i delare array with my / local , they will get destroyed when the control comes out of the function in which the addition happens
This is wrong, Perl5 counts the references to a variable/data structure and only destroys the container if no more references are held. Since you are keeping a reference to your array in the the hash, the array will only be destroyed when your hash goes away (i.e. goes out of scope with no more references held to it) and is destroyed itself.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -- Brian W. Kernighan