Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Best way to remove elem of for loop

by johngg (Canon)
on Apr 24, 2014 at 23:04 UTC ( [id://1083695]=note: print w/replies, xml ) Need Help??


in reply to Re: Best way to remove elem of for loop
in thread Best way to remove elem of for loop

You could use a do block to avoid having the -d directory test twice.

$ ls -F fred testFBF* xxx/ yyy/ $ perl -Mstrict -Mwarnings -E ' my @dirs = qw{ fred testFBF xxx yyy }; @dirs = map { -d $_ ? $_ : do { warn qq{Not a directory: $_\n}; () } } @dirs; say qq{Directories: @dirs};' Not a directory: fred Not a directory: testFBF Directories: xxx yyy $

I hope this is of interest.

Cheers,

JohnGG

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2025-11-06 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (65 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.