#!/usr/bin/perl use strict; use warnings; my $dir = '.'; #for embeding the mcsearch percompile version my $mcsearch = '/bin/mcsearch'; #to read the PDB files from the directory opendir DIR, $dir or die "Cannot open directory $dir:$!\n"; my @pdb_files = grep { -f $_ && $_ =~ /\.pdb$/ } readdir DIR; closedir DIR; print "Enter the script file"; $a=<>; open(IN,$a) or die; #giving each file as a input to mcsearch for my $file (@pdb_files) { while(<>) { my $content = `$mcsearch "$dir/$file"`; chomp $content; print "Content of $file is $content\n"; } }