#!/usr/bin/perl -- use strict; use warnings; use Capture::Tiny qw/ capture /; ... my @cmd = ( '/usr/bin/echo', 'whiskey', 'foxtrot' ); my( $stdout, $stderr, $exit ) = capture { system { $cmd[0] } @cmd; };; ...