in reply to unnecessary warning message?

Take a look at perlfaq7 . It has a question about it... (how can I pass/return a ...)

To pass a filehandle you should use *FH or \*FH, not FH

Also, if you would have 'use strict': then you would have gotten an error: 'Bareword "LOG" not allowed while "strict subs" in use'...

Replies are listed 'Best First'.
Re^2: unnecessary warning message?
by ysth (Canon) on May 08, 2005 at 16:56 UTC
    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.