-----Original Message-----
From: Bob Showalter [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 26, 2005 9:40 AM
To: Daniel Kurtz; beginners@perl.org
Subject: Re: Need a list of files in a dir.

Daniel Kurtz wrote:
> Ooh ooh ooh! One I know!
> 
> open(COMMAND, "dir |");
> @files = <COMMAND>;

Please tell me you're kidding.

-- 

This may be closer to what you want:

opendir(DIR, $somedir) 
   or die "cannot opendir $somedir: $!";
while (defined($somefile = readdir(DIR))) {
    # process "$somedir/$somefile"
}
closedir(DIR);

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to