in reply to Partition monitor, aka, I told you it was ugly
select OUTFILE; $|=1; select STDOUT;
Then you only have to open/close it once to read and once to write. You can print to it or read from it as many times as you want in between.
Since you are both reading and writing to it, you might want to use IPC::Open2. This module lets you read and write to the same handle. See its manpage for caveats.
You might also want to check into the Mail::Send module for sending mail without using system. In addition, you can avoid the system calls to `date` and `hostname` if you use the POSIX.pm strftime function and the Sys::Hostname module. These methods are more portable than your current implementation.
|
|---|