I hope that's what you want :

#FILEB.pl
use strict;
use warnings;

my $fileA = 'somewhere';

open (FILE_A, "$fileA");
my @DirList = <FILE_A>; ## So read all line
close (FILE_A);

foreach my $dir (@DirList)
{ chomp $dir; 
        # chomp : This might be not nesessary, I don't know, 
        # but this is no harm anyway.

   opendir LIST, $dir;

        my @filelist = grep ! /^\.{1,2}$/ ,readdir(LIST);
            # get the file list from $dir, but
            # kick out ./ and ../ from the list.

   closedir LIST;

    foreach my $fname (@filelist) { &do_sth_u_want($fname) }
        # I don't know if this part is what you mean to want

}

Rgds,
Connie

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 12, 2002 2:06 AM
Subject: Array


> Hello,
> 
> My question is most likely not unique.  I just have not been able to find
> the solution on my own. 
> 
> I would like to read lines of text from a file into an array, and perform
> some action on each line.
> ******************************
> Something like:
> FileA contains a list of absolute paths (/opt/web/someDir/some-other-Dir)
> Perl script B would read in the lines from FileA and place them into an
> array.
> 
> Then perl script B would use each element in the array to 
> A. move to that directory
> B. read in the contents of the dir
> C. perform an action on each line read in
> D. Loop to the next array element and continue 
> *********************************
> If this makes no sense I understand, but if someone out there has any ideas
> on how I can make this happen, please email me.
> 
> Thanks in advance.
> ***********************************
> Mike Van Hoff  - B.S., MCSE,CCNA,CCDA
> LAN Consultant
> Beverly Enterprises, Inc.
> 479.201.3850
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to