in reply to main package
In this code $var is declared in program.
Oops, it actually wasn't declared in the code you posted.
use strict; use warnings; and then declare your variable with my $var;. Assignment using the = operator is not variable declaration.
main is the default package name, you can change it by saying package foo;, useful in modules so that you can declare variables without stomping on other people's variables.
|
|---|