Actually, he is using 'ls -lrt'. If I'm not mistaken this will not display .files in the list, so we need that. I'd rather not include any invalid files in my sort process to begin with, hence my suggestion. In fact, if we start out with the correct file list and sort it based on stat, then we just need to do @return_list = @sort_list[0..4] without looping through the list at all.