in reply to Repeated File Opens Inefficient?
This is a simple problem. Just read the message body once, before your loop. Save it into a scalar, like so:
open MSGBODY, "$file" or die "Couldn't open $file: $!"; $message = join('', <MSGBODY>); for $member (keys %CONTACT) { ... $fh = $msg->open; print $fh $message;
If you have to do some per-user processing of the message, then look into some of the text templating systems. (I personally recommend Template::Toolkit.)
--rjray
|
|---|