in reply to problems returning from recursive subroutine

the problem is that your readdir loop is getting trashed by the re-entrant sub - each time you recurse, you lose the previous directory loop. Something like this works (tested too!)...
#!/usr/bin/perl -w use strict; lc_filenames(shift @ARGV); sub lc_filenames{ my($dir)=@_; $dir||="."; opendir DIR, $dir; my @files = readdir DIR; closedir DIR; foreach my $file(@files) { next if ($file =~ /^\.+$/); lc_filenames("$dir/$file") if(-d ("$dir/$file")); rename("$dir/$file", "$dir/".lc($file)) if($file=~/[A-Z]/); } }
Cheers, Ben