The traditional approach is to just use the filehandle twice:
sub openOut { select *main::OUT = *main::OUT; # squelch "used once" warning ...
Alternatively, you can disable the warning, see warnings:
sub openOut { { no warnings 'once'; select *main::OUT; } ...
The best approach IMO would be to do away with the global filehandle names alltogether and pass in the filehandle from the main program. but I guess that's beyond the scope of your question :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to suppress "only used once" regarding script file handles (that are in fact used in my module), but do it from a the module?
by hepcat72 (Sexton) on Nov 07, 2019 at 21:50 UTC | |
by Your Mother (Archbishop) on Nov 07, 2019 at 22:38 UTC | |
by hippo (Archbishop) on Nov 08, 2019 at 11:27 UTC | |
by tobyink (Canon) on Nov 08, 2019 at 09:56 UTC | |