Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Directory Listing

by athomason (Curate)
on Jul 29, 2000 at 23:37 UTC ( [id://25109]=note: print w/replies, xml ) Need Help??


in reply to Directory Listing

I may not be understanding your question correctly (getting a list of directories), but what's wrong with this?
#!/usr/bin/perl -w use strict; my $dirname = "."; opendir DIR, "$dirname" or die "couldn't open '$dirname': $!"; my @files = grep { -d $_ } readdir DIR; close DIR; print join "\n", @files;
I'm especially uncertain of what you're trying to accomplish with all your regexps. Could you be more specific about your intent?

Update:

Cleaned up a bit for the strict -w police.

Replies are listed 'Best First'.
RE: Re: Directory Listing
by elusion (Curate) on Jul 30, 2000 at 00:02 UTC
    Nothing's wrong with what you said, it worked great. I just am new to Perl, and don't know how to do everything yet. :) As to having the @array2 variable in my code, sorry about that. That was from one of my experiments to try to get it to work. My editor has this wacky Power Undo thing that undoes like 5 things at a time and I don't always catch it. Thanx for your help, I'm gonna try and understand it now.

    - p u n k k i d
    "Reality is merely an illusion, albeit a very persistent one."
    -Albert Einstein

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-03-29 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found