Time To Earn

Saturday, August 24, 2013

Perl Take Error and Output in one file


sub executeCommand
{
  my $command = join ' ', @_;
  ($? >> 8, $_ = qx{$command 2>&1});
}

my ($status, $output) = executeCommand ('/bin/ls', '/');

No comments:

Post a Comment