Also, if you would have 'use strict': then you would have gotten an error: 'Bareword "LOG" not allowed while "strict subs" in use'...Just wanted to note that prototyping carpout to expect a filehandle name fixes the bareword error, but not the "used only once" warning. IMO this could be construed as a bug.
$ cat carpout.pl; perl carpout.pl #!/usr/bin/perl -w use strict; sub carpout(*); sub handle_error { if (open LOG, ">/dev/null") { carpout(LOG); } } print "hello world.\n"; Name "main::LOG" used only once: possible typo at carpout.pl line 6. hello world.
In reply to Re^2: unnecessary warning message?
by ysth
in thread unnecessary warning message?
by argv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |