What does "my" really mean?

"The meaning of my $x is that you tell perl, and specifically to strict, that you would like to use a private variable called $x in the current scope. Without this, perl will look for a declaration in the upper scopes and if it cannot find a declaration anywhere it will give a compile-time error Global symbol requires explicit package name Every entry in a block, every call to a function, every iteration in a loop is a new world. "

Empty an existing variable:

$x = undef;
@a = ();
%h = ();

Source from: perlmaven


I flattered that you are quoting my articles, but it would be even nicer if you linked to the source.

Leave a comment

About flymike

user-pic Keep it simple, stupid.