$result = `command`; #### open OUTFILE, "> /path/to/outfile.txt"; print OUTFILE $result; close OUTFILE; #### system("command > /path/to/result.txt");