Er, why on earth do you tell him to use while and then to use while to do the exact same thing the for loop had been doing previously? Your method is still going to need to build the 17,000 element list and iterate over it, it just uses a more explicit form. A rewrite which gets around this would be simply:
in reply to Re: Re: Re: Efficient processing of large directory
in thread Efficient processing of large directory
This will only read a single file at a time and has no need to create huge lists.
while(my $x = <*.*>)