use IO::Dir; my($dir)=IO::Dir->new('/imageproc/files/ips/fullsize/') || die; my($c,$f)=0; while($f=$dir->read() and $c<=9) { print "$c $f\n"; $c++; }