in reply to One-shot code critique

foreach my $file ( grep /\.asp$/i, readdir DIR ) {

Why not use glob("$dir/*.asp") here instead of readdir?

(I expect to learn something here)

--
:wq

Replies are listed 'Best First'.
Re: Re: One-shot code critique
by tachyon (Chancellor) on Sep 28, 2001 at 22:04 UTC

    Besides TIMTOWTDI a number of operating systems have quite low limits to the number of files that get returned by a glob so if the target dir is large some files will just get omitted. Silently. Ouch.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Eek. So noted. Can you give some examples, or a pointer to more info? Sure be nice to know if my OS/shell was broken like this....

      (See? I told you I'd learn something.)

      --
      :wq