On Thu, Dec 16, 1999 at 10:25:46PM -0800, Robert Terwilliger wrote: > > $basedir = "# place root folder here #"; > > GetListing ($basedir); > > exit; > > sub GetListing { > my $parent = shift(@_); > my $file = ""; > print "\n\nFor directory \"$parent\:\"\n"; > > chdir($parent); > my @files = <*>; > > foreach $file (@files) { > if ($file =~ m/\w/) { > if (-f $file) { > print "$file is a file\.\n"; > } > > elsif (-d $file) { > GetListing ("$parent\:$file"); > } > } > } > } > You chdir() into a directory when entering the subroutine, but you never chdir() back to the parent directory when you exit the subroutine. Once you've chdir()ed as far down the tree as you can, all the @files contain filenames that are not in the current directory. You should chdir() back to the outer directory when exiting the function, or not chdir() at all and prepend the path to the glob and the filenames, or use the File::Find module, which does all the work for you. Ronald # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org