in reply to opendir or not?
while ($eachfile = <*.txt>) { ... }
@files = <*.txt>; foreach (@files) { ... }
opendir(DIR, ...); while (defined ($eachfile = readdir(DIR) )) { next if not /\.txt$/; ... }
Of course, there's platform differences to consider, too. Some filesystems bog down worse than others with long directories.
If you're bored, check that @files = <*.txt> is really just as fast as @files = glob("*.txt"), too.
--
[ e d @ h a l l e y . c c ]
|
|---|