Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by misterperl (Pilgrim)
on Oct 27, 2020 at 17:22 UTC ( [id://11123226]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11123226]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found