Hi,

I have a little advice to beg for :)

I'm reading a file, putting in certain lines,
actually, the lines are paths to files on our network.
I am going to put them into an array, and then run
file::find to double check, and put in a  new array
the the paths in the array actually match their actual
location. After that I want to put in the paths from
the new array into back into the file so the file
always has it's paths to other files updated and
over-written. How can I use an array with file::find?

I was thinking something along the lines of:

# @oldarray = pathnames from the file.
# @newarray = the updated pathnames from file::find

sub findfile {
     $count=$count+1;
     if ($_ eq $oldarray[$count])
               {
                 $newarray[$count] = file::find::name;
               }
             }
find \&findfile, "..";

after that, I was thinking of of opening the file
again, and searching/replacing the matched lines with
newarray lines:

eg. open(MYFILE, $match) || die "Can't open file: $!";

while (defined($a=<MYFILE>)) 
        {
$count=$count+1;
if ($a =~ /$oldarray[$count]/){
  $a = s/$oldarray[$count]/$newarray[$count]    
                }
        }

i have a little c++ experience and am not sure whether
@newarray[$count] is appropriate. no doubt this is
fraught with problems, but I need to use
search/replacement within the context of arrays...any
help would be appreciated..

thanx a million
Ben



__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

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

Reply via email to