use strict; use FileHandle; my $fh = FileHandle->new('capture.out',"w"); print $fh `dir`;