hi,
I am using the File::Find module to scan a dir tree, pulling out
files that have a specific extension. in a separate package, I wrote
a sub called get_all_files:
sub get_all_files :Export(:DEFAULT)
{
my ($cwd, $ext, @list_of_files);
$ext = shift;
$cwd = shift;
$ext = 0 unless defined $ext;
$cwd = `pwd` unless defined $cwd;
chomp $cwd;
sub wanted_files
{
my $infile = $File::Find::name;
my @parts = split(/\./, $infile);
if (!$ext || (pop(@parts) eq $ext)) {
push (@list_of_files, $infile);
}
}
File::Find::find(\&wanted_files, $cwd);
return [EMAIL PROTECTED];
}
in my script, I call get_all_files() like this:
@chime_spts = @{get_all_files('spt', 'ed5_livingfigures')};
print Dumper(@chime_spts);
@structure_files = @{get_all_files('pdb', 'ed5_livingfigures')};
print Dumper(@structure_files);
the first array is printed as expected; the second is never printed.
if I comment the first, the second does print. if I swap the order,
the new first one prints, and the new second one does not. if I call
get_all_files() twice with the same args, still only the first
prints. I know both calls reach my sub (tested with simple print
statements in the sub).
can anyone help? do I need to reset a pointer in File::Find or
something? I have read the documentation but I didn't find anything
relevant to this particular situation. I am running OS X 10.4.4, Perl
5.8.6 (standard Apple install), File::Find version 1.1.
thanks for any help,
tim
--
Timothy Driscoll em: [EMAIL PROTECTED]
Virginia Bioinformatics Institute ph: 540-231-3007
Bioinformatics I im: molvisions
Washington St., Blacksburg, VA 24061
"Well, it's going to suck today, but at least I'm not getting
smallpox." - Leiws Black
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>