Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opendir 1

Status
Not open for further replies.

biobrain

MIS
Jun 21, 2007
90
GB
Dear All,

I need your help. I have the following script. It is working fine.

Now I want to update it as

1. When ever I change my Script from one directory to an other I have to change the Directory address all the time in the script as well. Is there any possibility that opendir command automatically recognize the directory and then read the files from that directory.

2. Is there and possibility that I can type the directory address at the Linux command prompt while executing the script.



opendir(DIR,"/home/biobrain/first") or die "$!";
my @all_pdb_files = grep {/\.pdb$/} readdir DIR;
close DIR;

 

my $dirPath = $ARGV[0] or die "Need a Dir path:($!)\n";
chomp $dirPath;

opendir(DIR,"$dirPath") or die "Cannot Open $dirPath:($!)\n";

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top