in reply to find the last lexical entry in a dir without using @ls=readdir
And yes, I wanted to avoid reading tens of thousands of lines into memory just to get to the last entry. It seemed such a waste.my $max while ( my $file = readdir(DIR) ) { $max = $file if $file gt $max; } print $max;
|
|---|