in reply to A very deep recursion and the GD module (problem)

You are nesting your global variables. use strict; and declare them correctly. You're unnecessarily pushing your directories twice into @dir, so skip that line. Also grep only the desired files from the directory listing, adding a  grep { !/^\.\.?$/ }, which ignores "./" and "../".
This should work:
use strict; my @dirs; my $directory = "D:/Temp"; getdirs($directory); for my $dir (@dirs) { update($dir); } print "DONE\n"; sub getdirs { my $directory = shift; opendir (DIR, $directory); my @files = grep { !/^\.\.?$/ } readdir DIR; closedir DIR; push (@dirs, $directory); for my $file (@files) { if (-d "$directory/$file") { getdirs("$directory/$file"); } } }

Finally, as simon.proctor mentioned, I'd really recommend using File::Find for this kind of job.


--
trust in bash
but tie your camel