Write Command's Output In File
my $command = ... ;
open my $afile, ">", $logFileName or die "Couldn't open $logFileName: $!";
open my $fh, "$command |" or die "cannot run command: $!";
while ( my $row = <$fh> ) {
print $afile $row . "\n";
}
close $fh ;
close $afile ;
'Script > Perl' 카테고리의 다른 글
22. Excel (0) | 2020.01.21 |
---|---|
21. Directory (0) | 2020.01.21 |
19. File (0) | 2020.01.21 |
18. Package (0) | 2020.01.21 |
17. Module (0) | 2020.01.21 |