develooper Front page | perl.beginners | Postings from April 2002

RE: Writing Dir Names into a File

Thread Previous | Thread Next
From:
David Gray
Date:
April 1, 2002 06:41
Subject:
RE: Writing Dir Names into a File
Message ID:
001c01c1d98b$4fc9eec0$7800a8c0@3b2.com
Good morning,

> So I have modified my script a bit and it works. However, now 
> I want to not 
> read in the "." and ".." directories. How can I do this?? I am having 
> problems with this part.

I usually use the following code to do this:

opendir DIR,'$mydir'
  or die "couldn't open dir [$mydir]: $!\n\n";
# grep file listing
my @fl = grep { $_ ne '.' and $_ ne '..' }, readdir DIR;
closedir DIR;

Cheers,

 -dave



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About