in reply to Recursive sub efficiency
Nothing to do with efficiency but:
close (DIR); [download]
Should be:
closedir (DIR); [download]