$ perl -e " use diagnostics; my $c = $c; "
Name "main::c" used only once: possible typo at -e line 1 (#1)
(W once) Typographical errors often show up as unique variable nam
+es.
If you had a good reason for having a unique name, then just menti
+on it
again somehow to suppress the message. The our declaration is
provided for this purpose.
NOTE: This warning detects symbols that have been used only once s
+o $c, @c,
%c, *c, &c, sub c{}, c(), and c (the filehandle or format) are con
+sidered
the same; if a program uses $c only once but also uses any of the
+others it
will not trigger this warning.
The $c on the right side of my $c = is the global variable $main::c, and $main::c is not the same as $c
Also $ perl -e " use diagnostics; my $c = $c; my $c = $c; "
"my" variable $c masks earlier declaration in same scope at -e line 1
+(#1)
(W misc) A "my", "our" or "state" variable has been redeclared in
+the
current scope or statement, effectively eliminating all access to
+the
previous instance. This is almost always a typographical error.
+Note
that the earlier variable will still exist until the end of the sc
+ope
or until all closure referents to it are destroyed.
Name "main::c" used only once: possible typo at -e line 1 (#2)
(W once) Typographical errors often show up as unique variable nam
+es.
If you had a good reason for having a unique name, then just menti
+on it
again somehow to suppress the message. The our declaration is
provided for this purpose.
NOTE: This warning detects symbols that have been used only once s
+o $c, @c,
%c, *c, &c, sub c{}, c(), and c (the filehandle or format) are con
+sidered
the same; if a program uses $c only once but also uses any of the
+others it
will not trigger this warning.
So its my $c = $main::c; my $c = $c; and the second lexical $c takes places of the original lexical $c (my $c) ... so the first my $c is invisible |