in reply to Re: opening all files in a directory
in thread opening all files in a directory

appendum... You might want to do this
@Files = grep /\w/, readdir(DIR);
to avoid reading . and .. into the array.

cLive ;-)

Update:d'oh - thanks Randal.

Appendum to appendum... "assuming your file names containword chars".

Replies are listed 'Best First'.
Re: Re: Re: opening all files in a directory
by merlyn (Sage) on May 14, 2001 at 08:13 UTC
    But that'll miss the perfectly legitimate file named "!!!". Why are you ruling all of those out?

    The most straightforward is:

    @files = grep { $_ ne "." and $_ ne ".." } readdir DIR;

    -- Randal L. Schwartz, Perl hacker