RobertCraven
Programmer
Dear all,
I am first timer with Perl handeling directories (coming from Java). I have this directory structure:
[cologne]tj: tree ~/positiveSet/MMS/pdb0702211233/pdb/
/home/tj/positiveSet/MMS/pdb0702211233/pdb/
|-- 2c
| |-- 32c2_A.asa
| |-- 32c2_A.log
| |-- 32c2_B.log
| |-- 32c2_B.pdb
| |-- 32c2_B.rsa
| `-- pdb32c2.ent
|-- 3c
| |-- 33c2_A.asa
...
Initial directory is:
"/home/tj/positiveSet/MMS/pdb0702211233/pdb/"
First I need to open and process all files ending on ".ent", afterwards the ones ending on ".rsa"
This part works fine, I have all directories as keys in the hash. I am sure I haven't fully understood how Perl handles directories, when I try to create a second hash populated with the contents of the sub directories I get the contents of the current working directory:
Thanks for your help!
I am first timer with Perl handeling directories (coming from Java). I have this directory structure:
[cologne]tj: tree ~/positiveSet/MMS/pdb0702211233/pdb/
/home/tj/positiveSet/MMS/pdb0702211233/pdb/
|-- 2c
| |-- 32c2_A.asa
| |-- 32c2_A.log
| |-- 32c2_B.log
| |-- 32c2_B.pdb
| |-- 32c2_B.rsa
| `-- pdb32c2.ent
|-- 3c
| |-- 33c2_A.asa
...
Initial directory is:
"/home/tj/positiveSet/MMS/pdb0702211233/pdb/"
First I need to open and process all files ending on ".ent", afterwards the ones ending on ".rsa"
Code:
Use IO:Dir;
tie my %dir, 'IO::Dir', '/home/tj/positiveSet/MMS/pdb0702211233/pdb';
foreach my $key(keys %dir) {
}
This part works fine, I have all directories as keys in the hash. I am sure I haven't fully understood how Perl handles directories, when I try to create a second hash populated with the contents of the sub directories I get the contents of the current working directory:
Code:
tie my %dir, 'IO::Dir', '/home/tj/positiveSet/MMS/pdb0702211233/pdb';
foreach my $key (keys %dir) {
tie my %subdir, 'IO::Dir', $key;
print Dumper(\%subdir);
}
Thanks for your help!