On Wed, 17 Jan 2007 23:44:57 -0700, Dan Fish wrote: > I've got a perl wrapper that conditionally runs another perl program using > system() > > If( some_condition_applies){ > > system("myperlscript.pl"); > > } > > myperlscript.pl will complete silently if everything runs right, but > because it reads some data files and interfaces to a mySQL database, there > are times when it may encounter unforeseen errors. > > IF there is any output from myperlscript.pl, I'd like to capture it and send > it off in an email. The sending in an email part I can handle. and I think > I can probably redirect the output of myperlscript.pl to a file and read > that, but is there a better, more elegant way to capture any stdout/stderr > output WITHOUT having to redirect and read another file?
Look up backticks in perldoc perlop: my $output = `myperlscript.pl 2>&1`; send_email($output) if $output; -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/