Hi All~
my program below is not returning any errors but nothing is happening to the
.txt files like I hoped. Can someone pls take a look and let me know what
I'm doing wrong.
----- Thank you! ----
# If there is a .pdf file and a matching .txt file, open the .txt file and s
% http://.* % "$link" %
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
my $pdf_dir = "j:/flash_host/ecomm/descriptions/product/MSDS";
opendir(PDFDIR, $pdf_dir) or die "Can't open the $pdf_dir: $!\n";
# read file/directory names in that directory into @htmls
my @pdfs = readdir(PDFDIR) or die "Unable to read current dir:$!\n";
closedir(PDFDIR);
my $text_dir = "c:/brian/descriptions/product/small";
opendir (TEXTDIR, $text_dir) or die "Can't open $text_dir: $!";
# read all the .txt files and load @ARGV for <> operator
@ARGV = map { "$text_dir/$_" } grep { !/^\./ } readdir TEXTDIR;
my %PDFDIR_LIST;
$PDFDIR_LIST{$_}=1 for @pdfs;
foreach my $text_file (<>) {
my ($basename, $suffix) = fileparse($text_file,'.txt');
my $link = "descriptions/product/small/$basename.pdf";
if( $PDFDIR_LIST{"$basename.pdf"} ){
open FH, $text_file or die "can't open $text_file: $!";
s% http://.* % $link %;
next;}
}
close (FH);
closedir (TEXTDIR);
__END__
Brian Volk
HP Products
317.298.9950 x1245
<mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]