in reply to Re^2: Match text from txt to htmlin thread Match text from txt to html
Great! And is the code working correctly? (Quietly loads the confetti cannon.)
Alex / talexb / Toronto
Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.
this is my code as of now.
my $html = shift;
open(my $fh, '<', $html) or die "cannot open file $html";
$htmlvar = <$fh>;
my $line = 1;
if ($htmlvar =~ /$_/ && $htmlvar !~ /<sentence id\"[0-9]*\">$_<\/
$htmlvar =~ s/($_)/<sentence id\"$line\">$1<\/sentence>/;
When open fails, get it to tell you why:
open(my $fh, '<', $html) or die "cannot open file $html: $!";
Trying to parse HTML like this is more often than not a waste of time.
Thanks! I am opening the html this way as I don't know the nodes of the files. the created automatically, so this is why I am reading them as text.