Reputation: 1540
I have a perl script that I can pass arguments to from the command line and it will output the results. I have tried to capture those results:
$systemReturn = `$cmd`;
with only a response of an empty string. I know this file outputs a multi-line string. Obvously there is a diffirent method needed to capture it. Does anyone know how I would get this done?
Upvotes: 3
Views: 4022
Reputation: 4335
I would recommend checking up on Capture::Tiny or IO::CaptureOutput as well. It makes it easier and more portable to catch the output, split or join STDOUT and STDERR, check for success, and even tee.
Upvotes: 2
Reputation: 98398
The command probably outputs to stderr, not stdout. Try
$systemReturn = `$cmd 2>&1`;
Upvotes: 5