mdb has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying save the data from my system call to a log file. In the log file the output is:
INFO> SYB 1 TLM Check 0
INFO> SYB 2 TLM Check 0
INFO> SYB 3 TLM Check 0

The results from the system call are not being saved or logged. There should be 74 lines of output per syb. Any help is greatly appreciated.
#!/usr/local/bin/perl -w use strict; use Time::Local; use lib "$ENV{SCMS_HOME}lib"; use logme; my $logFileName = shift; logme::init($logFileName); my @syb1 = system("/home/cfso/scripts/EVL_Loggers/check_tlm_MCF_EA_SYB +1.csh"); logme::log("INFO","SYB 1 TLM Check @syb1\n"); my @syb2 = system("/home/cfso/scripts/EVL_Loggers/check_tlm_MCF_EA_SYB +2.csh"); logme::log("INFO","SYB 2 TLM Check @syb1\n"); my @syb3 = system("/home/cfso/scripts/EVL_Loggers/check_tlm_MCF_EA_SYB +3.csh"); logme::log("INFO","SYB 3 TLM Check @syb1\n");

Replies are listed 'Best First'.
Re: How to log a system call
by samarzone (Pilgrim) on Dec 13, 2010 at 08:23 UTC

    system returns the exit code of the command executed, which can be seen as "0" in your log file, and not the output. If you want the output of the shell script in the perl script you should use backticks (``) instead.

    my @syb1 = `/home/cfso/scripts/EVL_Loggers/check_tlm_MCF_EA_SYB1.csh`;
Re: How to log a system call
by Anonymous Monk on Dec 13, 2010 at 07:21 UTC