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

RE: Writing Dir Names into a File

Thread Previous | Thread Next
David Gray
April 1, 2002 06:41
RE: Writing Dir Names into a File
Message ID:
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;



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About