in reply to Global filehandles?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Global filehandles?
by ihb (Deacon) on Oct 19, 2004 at 22:16 UTC |