Yeah, I appreciate that the removal of . and .. may not be portable to your system, but you could just add a loop to iterate over the array in the subroutine before returning the list, finding both, and deleting the elements. Wouldn't be too hard - I write mostly on Windows where I work which is why I just shift them off the start of the array.