# Run the program and show the output my @result; @result = `$cmd 2>&1`; foreach my $result (@result) { print $result; chomp $result; }