On Aug 5, Brian Volk said:

Now that I have my program working ( much thanks to the group ) I'm totally
stumped as to why the substitution only works on some of the .txt files and
not all.     I'm attaching two files..  70119.txt and 30700.txt.  The s/ /
/; in the program below works for file 70119.txt and not for file
30700.txt..  and I have no idea why... :~)   If anyone can tell me why this
is happening, I would really appreciate it!

I would add debugging statements to make sure the loop is going over all the files you expect it to.

if( $PDFDIR_LIST{"$basename.pdf"} ) {
 my $out_file = "$text_file.new";
 open INPUT, "< $text_file"
    or die "can't open $text_file: $!";
 open OUTPUT, "> $out_file"
    or die "can't open $out_file: $!";

   warn "PDFDIR_LIST had $basename.pdf; operating on $text_file\n";

 while (<INPUT>) {
  s% http://.* % $link %g;
  print OUTPUT;
 }
 close INPUT; close OUTPUT;
 move( $text_file, "$text_file.bak" );
 move( $out_file, $text_file );
}
}

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

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


Reply via email to