You should use warnings; use strict; at the top of all your scripts, and you should check the return values of functions for errors (in this case opendir). Here's a version incorporating that and a bit of cleanup:
#!/usr/bin/env perl use warnings; use strict; use IPC::System::Simple qw/system/; # recommended but optional opendir my $dh, "." or die "opendir failed: $!"; my @files = grep {/\.dbf$/} readdir $dh; closedir $dh; foreach my $file (@files) { system(qq{dbf_dump --fs "," "$file" > $_.csv})==0 or die "system() failed (\$?=$?)"; }
Note the error handling code on system isn't really needed if you use IPC::System::Simple.
In reply to Re: dbf_dump to apply to multiple files in a directory
by Anonymous Monk
in thread dbf_dump to apply to multiple files in a directory
by solanum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |