The following subroutine is extracting HTML from a text file. It works fine in other instances but in this particular case I am losing the value of $PRIFMESS.
Instance 1 - it contains data
Instance 2 - it is blank
So nothing is returned.
Am I missing the obvious?
Keith
Instance 1 - it contains data
Instance 2 - it is blank
So nothing is returned.
Am I missing the obvious?
Code:
sub create_prifmess_from_html{
my $filename="html/".$_[0];
my $part;
open (LOG, "<".$filename) || &errormess(34,"Cannot open $_[0]");
my @allmessages=<LOG>;
close (LOG);
my $html_on;
my $PRIFMESS="";
foreach $part (@allmessages){
chomp $part;
if($part eq "<!-- COMMENCE HTML -->"){$html_on=1}
if($part eq "<!-- FINISH HTML -->"){$html_on=0}
my $LENF=length($part);
if($LENF>0){
if($html_on == 1){$PRIFMESS.=$part}
}
[RED]print "1 - $PRIFMESS";[/RED]
}
[RED]print "2 - $PRIFMESS";[/RED]
return($PRIFMESS);
}
Keith