in reply to How to output backtick or qx to a variable and STDOUT at the same time?
I’m not exactly clear on what you want, but the CPAN module Capture::Tiny will almost certainly meet your needs. For example (from the documentation):
($stdout, $stderr, $exit) = capture { system($cmd, @args); };
Update: For your specific example:
#!usr/bin/perl use strict; use warnings; use Capture::Tiny qw(capture); my ($stdout, $stderr, $exit) = capture { system('ls', '-l'); }; print "After the system call:\n"; print "\$stdout = $stdout\n"; print "\$stderr = $stderr\n"; print "\$exit = $exit\n";
Hope that helps,
Athanasius <°(((>< contra mundum
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to output backtick or qx to a variable and STDOUT at the same time?
by dr.jekyllandme (Sexton) on Nov 20, 2012 at 06:43 UTC |
In Section
Seekers of Perl Wisdom