Depending on the version that you are using there are 2 different File::Find
modules.
The Module changes greatly in the perl version 5.6.1+.

I tried using the older version of the module with 5.005 and it just didn't
cut it for me. The new version allows following symbolic links and
preprocessing of the files

an example of what you want to do (using the new version of File::Find) is
below:

open(LIST, ">htmlfiles.txt");
find ( {        preprocess => sub { return grep -d || /\.html?$/, @_; },
                wanted => \&dostuff2file,
                }, ('/dir/of/html/')    # recurses down the directories
                );

sub dostuff2file {
        print LIST "$File::Find::name\n"; # full path of the file name
        open (HTML, ">+$_") || die "Cannot open $File::Find::name: $!\n";
        {
                # do stuff here 
        }
        close HTML, "$_";
        # finish up stuff here

        } ## think of this subroutine as a foreach (@files) it starts again
with the next file setting $_, $File::Find::name and currently in the
directory of the file

__END__

a similar subroutine can be used for the older version but it's a little
more tricky.
check out the page at
http://search.cpan.org/doc/JHI/perl-5.7.1/lib/File/Find.pm

-----Original Message-----
From: Ben Crane [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 23, 2002 9:55 AM
To: [EMAIL PROTECTED]
Subject: Opening more than one html file for editing


Hi List,

Right, in line with my earlier question of using perl
and mapbasic-I would like to know if it's possible to
do the following:

1. Use File::Find to determine all HTML files and put
them into a txt file (Already done!)
2. Go through the txt file (sequentially), opening the
first file. (>>>THE MAIN PROBLEM<<<)
3. Search and replace text within this file.(Not a
problem)
4. close file and repeat step 2. with the next file in
the txt file list.

I need to edit and add html tags to over 100 html
files...I would like to do this automatically...my
only problem is opening more than one file at a time
to edit.

Open ???? || die "$_";
can ???? be a variable? Can this variable be defined
as a scalar and therefore each entry in the txt file
will be loaded, processed and closed?

Thank you,
Ben

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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

Reply via email to