in reply to
script and its output on different handles
I've used IO::Tee to do this kind of thing in the past. In short, you use the module to create a file handle pointing to your log file and STDOUT kind of like this:
open( my $log_fh, ">>", "mylog.txt" ) || die "Can't open the log for w
my $output = IO::Tee->new( \*STDOUT, $log_fh );
print $output "Starting the script...\n";
That should print 'Starting the script...' to both the logfile and the screen. Also, since you now have a couple file handles at your disposal, you can just print to the screen or just print to '$log_fh' at will if you like.