Modifying output of child process to add a timestamp

view full story

http://stackoverflow.com – I have a perl script which forks child processes. sub my_exec{ my($args,$stdout, $stderr) = @_; my $processes = fork(); die("Cant fork") unless defined($processes); if(processes == 0){ if(defined $stdout){ close(STDOUT); open STDOUT, $stdout; } if(defined $stderr){ close(STDERR); open STDERR, $stderr; } exec @$args; }else{ ... } } My main issue is that I want to add a timestamp to every line of output to stderr. I was wondering if it could be done here. as you can (HowTos)