#!/opt/local/bin/perl -w use IPC::Run; use strict; $workdir="/fma/prod1/isa/logs"; $logfile="$workdir/test.log"; open(LOG,">$logfile") || die "Error: Could not open $logfile: $!\n"; print "*-*-begin_run-*-*\n"; chdir("$dir"); @cmd=$ARGV[0]; { run (\@cmd, '>pty>', sub{ print "$_[0]";}, '2>', sub { chomp $_[0]; print "$_[0]\n";}) or die("Error executing child. Child returned $&\n"); } print "*-*-end_run-*-*\n"; close(LOG);