Update:

Thanks everyone for the help.

I ended up using Mug's version.


**************************************************************
#/usr/bin/perl
use strict;
use warnings;

my $csv = 'auth.txt'; # replace your csv file name here
open FH, $csv or die "canot open file $csv: $!\n";
for(<FH>)
{
        chomp;
        if (/(.+?),(\d+)/)
        {
        my ( $file, $num ) = split /,/ , $_ ;

        if ( -e $file && $num =~ /^\d{5}$/ )
        {
           open HTML, $file or die $!;
            local $/ = undef;
            my $newContext = <HTML>;
            close HTML;
            $newContext =~ s/(author_id = )"(\d+)"/$1"$num"/g ;

           open HTML, "+>$file" or die $!;
               print HTML $newContext;
           close HTML
        }
        else {
            print "$file - $num Error\n"
              }
        }

}

**************************************************************************

You will notice I changed it from a CSV to a txt doc. Perl was adding
" " around the filenames causing errors. Once it was reading the list
from a txt file it worked great.

Thanks again.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to