sub get_old_files() { my ($base_dir, $age_limit) = @_; my ($filename, $full_path); my $mtime = 0; my @tmp_files; my @files; my @new_files; opendir(DIRHANDLE, "$base_dir"); while ($filename = readdir(DIRHANDLE)) { $full_path = $base_dir . '/' . $filename; push(@tmp_files,$full_path); } closedir(DIRHANDLE); foreach $full_path (@tmp_files) { if (-d $full_path) { next if ($full_path =~ /.*\/(\.){1,2}$/); # Open get_old_files and return results print "Spawning new function for $full_path\n"; @new_files = &get_old_files($full_path,$age_limit); print Dumper @new_files; # @files = (@files,@new_files); } else { $mtime = (stat($full_path))[9]; if ($mtime < (time() - (86400*$age_limit))) { push(@files,$full_path); } } } # End while files return @files; } # get_old_files