in reply to usage of "my" keyword

If I am getting you right, you are not able to declare a variable without "my" in this code, That is because you are under strict pragma.
Your first line of code
 use strict;
enforces that the variables are declared properly, for more detailed reading please check perl docs perl docs

For your second question please see perl docs or perl maven

Life is a Climb, But view is Great...
Deepak