display | more...
In Perl, my is an adjective modifying a newly-referenced variable. It causes the variable named to be lexically local to the surrounding BLOCK, instead of being global as is the default.

For instance, if you read a line into a new variable $line as such, the variable will be global:

$line = <STDIN>;
In order to cause this to be a local variable instead, you must do this:
my $line = <STDIN>;
Note that my has a completely different effect from the (somewhat confusingly-named) adjective local. my causes the modified variable to go out of lexical scope at the end of the BLOCK. local causes an otherwise global variable to carry a temporary local value for the remainder of the BLOCK.

You probably want to be using my, not local, so you get all the scope checking featurefulness.