in reply to Re: How can I readdir and ! -d in one line
in thread How can I readdir and ! -d in one line

Ahh well crafted my friend, another ++ vote.. It occurs to be in linux I might PIPE the result to ! -d or something , but I don't know about any Perl pipe.

TYVM

  • Comment on Re^2: How can I readdir and ! -d in one line

Replies are listed 'Best First'.
Re^3: How can I readdir and ! -d in one line
by Fletch (Bishop) on Oct 27, 2020 at 17:46 UTC

    A perl equivalent (of sorts) might be to chain greps on different conditionals, but (IMHO) that's not particularly clearer in this case than simply having the one predicate step check both conditions (not-dir and starts with a wordchar) at the same time.

    my @files = grep { ! -d qq{$myDir/$_} } grep { /^\w/ } readdir( I );

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.