Guest_imported
New member
- Jan 1, 1970
- 0
- 0
- 0
I wrote this to get rid of html tags in a bunch of text files that are all named similarly. It seems to access the first file and get stuck. What is wrong with my method of opening the file and reading it? I'm pretty sure there's something wrong with my second "while".
#!/usr/bin/perl -w
use strict;
undef $/; #Makes it read a file at a time instead of the default line at a time.
my $x = 0;
my $filename2 = "exxonURL" . $x;
my $dollar_one = "";
while($x <= 365) {
$filename2 = "exxonURL" . $x;
$filename2 = $filename2 . "\.htm";
open (TagDeletingStream, "> $filename2" ||die "Can't open file: $!";
while ( <> ) {
m/(.*)/gis;
$dollar_one = $1;
$dollar_one =~ s/<[^>]+.//gis;
print TagDeletingStream $dollar_one;
}
$x++;
close (TagDeletingStream);
}
#!/usr/bin/perl -w
use strict;
undef $/; #Makes it read a file at a time instead of the default line at a time.
my $x = 0;
my $filename2 = "exxonURL" . $x;
my $dollar_one = "";
while($x <= 365) {
$filename2 = "exxonURL" . $x;
$filename2 = $filename2 . "\.htm";
open (TagDeletingStream, "> $filename2" ||die "Can't open file: $!";
while ( <> ) {
m/(.*)/gis;
$dollar_one = $1;
$dollar_one =~ s/<[^>]+.//gis;
print TagDeletingStream $dollar_one;
}
$x++;
close (TagDeletingStream);
}