#!/usr/bin/perl -w
use strict;

# (see tutorial on redirecting STDERR here at the ooOPPs Code Library under
# the "/tutorials" section-
#        <URL http://ooopps.sourceforge.net/cgi-bin/archive.pl/pub/tutorials/

# easily redirect STDOUT, STDERR, or STDIN like this

my($script) = __FILE__; $script =~ s/^.*(?:\\|\/|\:)//;

open(*STDOUT, qq[>>/var/tmp/$script.log]) and print(<<'__RD__');

   This output will be sent to a log, rather than STDOUT.

__RD__

open(*STDERR, qq[>>/var/tmp/$script.error.log]) and warn(<<'__RD__');

   This warning will be sent to an error log, rather than STDERR.

__RD__