The short answer is you should always use the "strict" pragma and declare all your lexical variables with "my". The use of "strict" is a pretty lengthy topic, here is an article that discusses it more in depth:
perl.com: Beginners Intro to Perl - Part 6
The article is a little old but seems to still be relevant.