Mathew Snyder schreef:
> Dr.Ruud:

>>    my @filenames = grep -f "$dir/$_",  sort readdir DH;
>
> Interesting.  The above line returns 1648 items while the following
>
> @filenames = sort grep { !/^\.$|^\.\.$/ } readdir $dh;
>
> returns 1650.

That would mean that there are 2 other "no-plain-files" inside your
$processDir.

See `perldoc -f -f` again.


The '.' and '..' are directories, not plain files.

You can write

  !/^\.$|^\.\.$/

as

  !/^\.\.?$/

so also as

  !/^[.][.]?$/


To find the missing two:

  perl -Mwarnings -Mstrict -le '
    my $dn = q{/usr/bin} ;
    opendir my $dh, $dn or die qq{opendir $dn: $!} ;
    my @fn ;
    if (1) {
      @fn = sort grep { /^[.][.]?$/ } readdir $dh ;
    } else {
      @fn = sort grep !-f "$dn/$_",  readdir $dh ;
    }
    print "@fn\n", scalar @fn ;
  '

Copy-paste that code to your command line. Change the "if (1)" to "if
(0)" to activate the other line.

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