in reply to How do I read files from a folder and place them into a list?

opendir DIR, $dir or die "error: cannot open directory \"$dir\" $!"; @files = sort grep (!/^\.$|^\.\.$/, readdir(DIR)); closedir (DIR);

Replies are listed 'Best First'.
Re: Answer: How do I read files from a folder and place them into a list?
by cLive ;-) (Prior) on May 29, 2004 at 05:17 UTC
    Simplified:
    @files = sort grep (!/^\.\.?$/, readdir(DIR));
    cLive ;-)