Thanks for the hints, I will try the split suggestion.
The default value of $limit is 20
I suppose you were testing on a desktop machine; pushing the boundaries of my knowledge, is it possible that I get a very different result because I am mainly testing on servers (HP-UX), where there is a possibility that the heavy use of I/O is slowing down the process ?
I am sure there is nothing else causing the difference because apart from this routine the program only contains code to pretty print the results of this routine, and a few sanity checks ( 3x stat syscall per number of files to be read )
Unfortunately I cannot provide a trace from the machines where it takes longer to run, as they are "production" and I am not allowed to play with them :)