use strict; use warnings; use Cwd; use Benchmark; my $dir = 'c:/windows'; my ( @a1, @a2 ); timethese 1, { glob => sub { my $cwd = getcwd; chdir $dir; @a1 = glob '*/*'; chdir $cwd; }, read => sub { my $cwd = getcwd; chdir $dir; opendir my $h, '.' or die; my @a = grep { $_ ne '.' and $_ ne '..' and -d $_ } readdir $h; for my $d ( @a ) { opendir my $hh, $d or next; push @a2, map "$d/$_", grep { $_ ne '.' and $_ ne '..' } readdir $hh; } chdir $cwd; } }; use Test::More; is $#a1, $#a2, 'array lengths are equal' or do { use Test::Differences; eq_or_diff [ sort @a1 ], [ sort @a2 ], 'look deeper', { context => 0 };; }; done_testing;