Should not have a problem. (Obviously you can wrap this in a class.)
use strict; use warnings; open_log(); a(); b(); close_log(); sub a { logging("Entering a\n"); logging("Entering a\n"); } sub b { logging("Entering b\n"); logging("Entering b\n"); } sub logging { print LOG shift; } sub open_log { open(LOG, ">", "log"); } sub close_log { close LOG; }
This gave me:
Entering a Entering a Entering b Entering b
In reply to Re: Global filehandles?
by pg
in thread Global filehandles?
by Marknel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |