- or download this
$ perl -le 'opendir my $fd, "."; my @files = readdir $fd; closedir $fd
+; print scalar @files'
48
$ perl -le 'my @files = <*>; print scalar @files'
7
$ _
- or download this
$ perl -le 'my @files = (<*>,<.*>); print scalar @files'
48
$ _
- or download this
use Benchmark qw(:all) ;
cmpthese(20000, {
readdir => sub { opendir my $fd, "."; my @files = readdir $fd; close
+dir $fd; },
...
Rate glob readdir
glob 3170/s -- -75%
readdir 12739/s 302% --