in reply to Re^2: Using Perl saves time....
in thread Using Perl saves time....

You are right - glob is slower than readdir.
My point is the short one-liner. Otherwise:
# time ls | wc -l 99999 real 0m1.850s user 0m1.590s sys 0m0.210s # time perl -e '@_ = glob"*";print$#_' 99998 real 0m1.462s user 0m0.880s sys 0m0.570s # the best alternative: # time perl -MIO::Dir -e '@_ = IO::Dir->new(".")->read;print$#_' 100000 real 0m0.680s user 0m0.570s sys 0m0.100s