http://qs321.pair.com?node_id=761969

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

I am attempting to call a function from within a perl script that will contact a monitoring program. I am getting compilation errors on this line of code.

 $testmessage = system(/usr/bin/postemsg -S tecserver -r(harmless) -m "(This is a test message)" hostname=(Trapeze) notify_action=email alias_notify=(pbkhk) (Event_Message_Class) (SOURCE));

I am getting the following as output:

Bareword found where operator expected at TDC-fabric-monitor.pl line +172, near "/usr/bin" (Missing operator before bin?) Unquoted string "tecserver" may clash with future reserved word at TDC +-fabric-monitor.pl line 172. Unquoted string "harmless" may clash with future reserved word at TDC- +fabric-monitor.pl line 172. Bareword found where operator expected at TDC-fabric-monitor.pl line 1 +72, near "m "(This is a test message at the end of the script)" hostn +ame" (Do you need to predeclare m?) Bareword found where operator expected at TDC-fabric-monitor.pl line 1 +72, near ") notify_action" (Missing operator before notify_action?) syntax error at TDC-fabric-monitor.pl line 172, near "/usr/bin" Execution of TDC-fabric-monitor.pl aborted due to compilation errors

Is there any way to format the system call so that Perl just passes that call to the outside shell? Should I be using something other than system() to call the postemsg command?

Thanks,

-Bill