in reply to Re: Directory Listing
in thread Directory Listing

my @files = grep !/^\.\.?/ && /.*pm$/, readdir DIRH;
That not only exludes dot and dot-dot, but anything beginning with dot and dot-dot. Maybe it was intended to exclude ".random.pm", perhaps?

But yes. On a code review, I'd mark that line as "either do what you mean, or write what you mean as a comment".

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: Re: Re: Directory Listing
by turnstep (Parson) on Jan 09, 2001 at 21:20 UTC

    Update: Read these out of order, but was basically reinforcing the point that all we need is:

    my @files = grep /pm$/, readdir DIRH
      If you really want to match Perl modules, that should of course be: grep /\.pm$/, readdir DIRH; Otherwise, you're going to match rpm files, ppm files, and any other files ending in pm. :)

        Perl modules? I thought pm was for Perl Monks!

        Or is that Perl Mongers?

        Hrmmm..the real question is, why makes the letter combination "pm" so attractive to perl-related things? :)