but this generates the following warning in perl v5.8.8:sub generate_post { #need to redirect STDOUT open(SAVE_OUT, ">&", STDOUT); open(STDOUT, "> $POST_FILE") || die "Can't redirect stdout"; more code goes here... #end of the subroutine: #need to restore STDOUT(!?) close(STDOUT); open(STDOUT, ">&", SAVE_OUT);
How can I get rid of this warning?Name "main::SAVE_OUT" used only once: possible typo at ./part2.pl line + 332 (#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.
In reply to getting rid of a warning by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |