in reply to Reading specific files from a directory

I just wanted to comment on using glob as some monks have proposed.

Generally, it works fine, but be careful if there are many (>1000) files in the directory as it can be slow. If there are, it would probably be better to user readdir and grep. -Scott

  • Comment on Re: Reading specific files from a directory

Replies are listed 'Best First'.
(tye)Re: Reading specific files from a directory
by tye (Sage) on Mar 13, 2001 at 21:30 UTC

    Modern versions of Perl implement glob using readdir and grep or even faster equivalents written in C and compiled into the perl executable. For older versions of Perl, glob is the sucking death and should be avoided at almost any cost.

            - tye (but my friends call me "Tye")
      What counts as "older versions of perl"? I am using 5.005(+/-) and when working with lots of files (sometimes more than 20,000), glob just doesn't work.

      Thanks for pointing this out though, as it indicates that it may be time for me to move on (to a newer version, that is).

      --Scott

        Based on a quick look at the Changes* files, it looks like this change was made in 5.6.0.

                - tye (but my friends call me "Tye")