Re: substitution doesn't work on all files ?
- From: japhy@xxxxxxxxxxxx (Jeff 'japhy' Pinyan)
- Date: Sat, 6 Aug 2005 09:07:27 -0400 (EDT)
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 .
- References:
- substitution doesn't work on all files ?
- From: Brian Volk
- substitution doesn't work on all files ?
- Prev by Date: substitution doesn't work on all files ?
- Next by Date: Module question
- Previous by thread: substitution doesn't work on all files ?
- Next by thread: Module question
- Index(es):
Relevant Pages
|