in reply to how to acces local varialbe

Local variables are really global variables in disguise, and they are used to temporarily change the value. The temporary value are confined to be effective inside the innermost enclosing block. In your code, the temporary value 10 of $a is only seen from its declaration to the end of the subroutine.