Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Producing 2 lists from a grep call

by BrowserUk (Patriarch)
on Jun 16, 2002 at 19:22 UTC ( [id://174955]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @dirs = grep { -d "$base/$_" and $_ ne "." and $_ ne ".." } readdir
    +(DIR);
    
  2. or download this
    my (@dirs,@files) = grep 
       { -d "$base/$_" and $_ ne "." and $_ ne ".." }
       { -f "$base/$_" } 
       readdir(DIR);
    
  3. or download this
    my @all = readdir(DIR);
    my @dirs = grep 
       {-d "$base/£_" and $ne "." and $_ ne ".." } @all;
    my @files = grep 
       {-f "$base/£_" } @all;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 07:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found