Help for this page

Select Code to Download


  1. 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
    $ _
    
  2. or download this
    $ perl -le 'my @files = (<*>,<.*>); print scalar @files'
    48
    $ _
    
  3. 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%      --