in reply to getting rid of a warning
If you change use a lexical variable for for SAVE_OUT then the warning goes away. It is also safer, you never know when there will be another SAVE_OUT somewhere else in the code and data mysteriously disappears.
open( my $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 );
Update: There are some fast monks out there;)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: getting rid of a warning
by Anonymous Monk on Jan 21, 2008 at 21:42 UTC |