my @files = grep { -f } glob '/path/to/files/*'; for my $file (@files) { my $output = `/path/to/parser.exe $file`; # do stuff with $output }