J
jidanni
Here we see "my" suppresses "used only once" warnings.
And I thought "my" was all good.
$ perl -we 'use diagnostics; $g=1; my $h=2;'
Name "main::g" used only once: possible typo at -e line 1 (#1)
(W once) Typographical errors often show up as unique variable names.
If you had a good reason for having a unique name, then just mention 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 so $c, @c,
%c, *c, &c, sub c{}, c(), and c (the filehandle or format) are considered
the same; if a program uses $c only once but also uses any of the others it
will not trigger this warning.
What about $h? "perldoc -f my" doesn't warn about no warnings. Even
perlsub doesn't say...
And I thought "my" was all good.
$ perl -we 'use diagnostics; $g=1; my $h=2;'
Name "main::g" used only once: possible typo at -e line 1 (#1)
(W once) Typographical errors often show up as unique variable names.
If you had a good reason for having a unique name, then just mention 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 so $c, @c,
%c, *c, &c, sub c{}, c(), and c (the filehandle or format) are considered
the same; if a program uses $c only once but also uses any of the others it
will not trigger this warning.
What about $h? "perldoc -f my" doesn't warn about no warnings. Even
perlsub doesn't say...