cseligman has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my $outputfile ="Test_PDB_ID_list.txt"; my $four_char_PDB_ID=''; open (PDB_IDs,">", "$outputfile"); my $PDB_ID= ''; my $dir_to_process= ''; print "What is the directory to process?"; $dir_to_process = <STDIN>; #$dir_to_process = "Targets-IonChannel";-if I used this #line it would + work #open the folder unless (opendir(DH, $dir_to_process)){ print "Cannot open folder $dir_to_process!\n"; } print "$dir_to_process\n"; foreach $PDB_ID (readdir DH){ $four_char_PDB_ID =substr($PDB_ID,0,4); print PDB_IDs "$four_char_PDB_ID\n"; print "$four_char_PDB_ID \n"; }; exit;
What is the directory to process?
Targets-IonChannel
Cannot open folderTargets-IonChannel
!Targets-IonChannel
readdir() attempted on invalid dirhandle DH at C:\Users\cseligman\Documents\Eclipseworkspace\DrugTargets\GetPDBnames-1.pl line 21, <STDIN> line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Get a DH from <STDIN>?
by ikegami (Patriarch) on Mar 29, 2011 at 17:11 UTC | |
|
Re: Get a DH from <STDIN>?
by wind (Priest) on Mar 29, 2011 at 17:10 UTC | |
|
Re: Get a DH from <STDIN>?
by jethro (Monsignor) on Mar 29, 2011 at 17:12 UTC | |
|
Re: Get a DH from <STDIN>?
by Anonymous Monk on Mar 29, 2011 at 17:09 UTC | |
|
Re: Get a DH from <STDIN>?
by jpl (Monk) on Mar 29, 2011 at 17:50 UTC |