in reply to Re^2: How to embed a tool in my script
in thread How to embed a tool in my script

Well, no. Probably not.

I'm not exactly clear whether you want to pass each entire file to your external tool, or whether you want to open each file and then pass it line by line. I guess probably the former. If that's the case, then perhaps this example will help.

$ echo 'some text' > 1.pdb $ echo 'some more text' > 2.pdb
Lets say for example your external tool is /bin/cat, and you want to cat each file and capture the output.
$ cat #!/usr/bin/perl use strict; use warnings; my $dir = '.'; my $cat = '/bin/cat'; opendir DIR, $dir or die "Cannot open directory $dir:$!\n"; my @pdb_files = grep { -f $_ && $_ =~ /\.pdb$/ } readdir DIR; closedir DIR; for my $file (@pdb_files) { my $content = `$cat "$dir/$file"`; chomp $content; print "Content of $file is $content\n"; }
$ perl Content of 1.pdb is some text Content of 2.pdb is some more text
That should be enough to get you going?