in reply to Re^2: Is it possible to "use vars" or "our" a file handle?
in thread Is it possible to "use vars" or "our" a file handle?
BEGIN { no warnings qw(once); open(MESSAGES,'>msg.txt') or die "$!"; }
since the warning removal will be scoped to the begin block and will only affect the known warning (see perllexwarn for the list of warning categories). Use of our will also suppress the warning and maintain global scope. Global scope can also be accomplished with package variables (open($main::messages,'>', 'msg.txt') or die "$!";), but this will still display the once warning, as well as will have precedence issues w/o the parentheses.
|
|---|