in reply to Re: read directory
in thread read directory
I just benchmarked the difference between "glob" and "<>" and found very little difference (subsequent runs flip-flopped which was faster). If that's the case, then I'd prefer the glob('pending/*') over the <pending/*> call because of the awkward bare word. But then, thats just me.
and the results#!/usr/bin/perl use strict; use warnings; use Benchmark qw(cmpthese); cmpthese( 20_000, { '<>' => sub { my @results = <pending/*>; }, 'glob' => sub { my @results = glob('pending/*'); }, }, );
Rate glob <> glob 7194/s -- -0% <> 7220/s 0% --
-biz-
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: read directory
by shmem (Chancellor) on Jul 08, 2006 at 14:28 UTC | |
Re^3: read directory
by Hue-Bond (Priest) on Jul 08, 2006 at 14:33 UTC |