"Dr.Ruud" schreef:
> Mathew Snyder:

>> foreach my $file (sort(readdir DH)){
>>         push @filenames, $file;
>> }
>
> You sort too early.

Ignore that. Just use John's alternative:

  my @filenames = sort readdir DH;

or make that

  my @filenames = sort grep -f, readdir DH;

Globs are sorted nowadays, I don't know whether readdir is too.


> Now, your $filenames can also contain names of directories.

Oops: s/[$]/[EMAIL PROTECTED]/


>   my @filenames = grep -f, <$processDir/*> ;
>
> (but that @filenames uses more memory).

It uses more memory because the full pathname is in each element.

-- 
Affijn, Ruud

"Gewoon is een tijger."



-- 
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