in reply to How to send the Output from system command into a file

TIMTOWTDI.

my $output = qx{ls}; ( open my $file, '>', 'filename' ) or die "Cannot open file 'filename' + for writing: $!\n"; print $file $output; close $file or die "Error writing to file 'filename': $!\n";

See perlop for information about qx and other quote-like operators.