Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: Producing 2 lists from a grep call

by Aristotle (Chancellor)
on Jun 17, 2002 at 12:28 UTC ( [id://175057]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Producing 2 lists from a grep call
in thread Producing 2 lists from a grep call

I think we can agree that the FOR LOOP/IF STATEMENT is probably a nicer solution ? :)
Especially since it's almost the for loop I posted - just s/map/for/, pull the (readdir DIR) up top, slip a next into the loop, and there you have it.

If you actually want something that's not a for loop in disguise, you could pull a really horrible trick like
my @dir; my @files = map { ($_ ne '.') && ($_ ne '..') && -d "$base/$_" ? do { push @dir, $_; () } : -f "$base/$_" && $_ } readdir DIR;
But if the Communications Decency Act had gone through I wouldn't have been able to even post this.

Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-24 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found