http://qs321.pair.com?node_id=749363


in reply to Limiting a glob

perl -e 'while ($s=<*>) { print $s,"\n"; sleep 5 }'

As you can see a glob can read filenames one file at a time (hopefully perl really buffers the filenames in the background and doesn't read them in all at once). You might change it to something like this:

use strict; use warnings; my @files; my $filecount=0; while (my $s=<*>) { push @files, $s; if (++$filecount>=100) { DoTheMoveWith(@files); $filecount=0; } } DoTheMoveWith(@files) if (@files);