Skip to content

Instantly share code, notes, and snippets.

@tianchaijz
Created July 22, 2014 10:17
Show Gist options
  • Save tianchaijz/bc39b4999ffb76858444 to your computer and use it in GitHub Desktop.
Save tianchaijz/bc39b4999ffb76858444 to your computer and use it in GitHub Desktop.
use Capture::Tiny 'tee';
my $output = tee { system( "some command" ) };
# http://stackoverflow.com/questions/634508/how-can-i-send-perl-output-to-a-both-stdout-and-a-variable
----
use IPC::System::Simple qw(capture);
# Capture output into $result and throw exception on failure
my $result = capture("some_command");
# http://stackoverflow.com/questions/2415954/how-can-i-store-perls-system-function-output-to-a-variable
----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment