Hi everybody,
I had generated the links from and stored the web pages as text and i need to extract some fields from that text file using pattern matching
some portion of my text file is
-
<p><span>Contact Name:</span>Kent Busse</p>
-
-
<p><span>Contact Title:</span>Owner</p>
-
Now here is the which i had tried so far by parsing...
use bytes;
-
$parser = HTML::Parser->new(text_h => [ sub { print TMPFILE shift },"dtext" ]);
-
no bytes;
-
$parser->parse($lines); #Parsing HTML files
-
@lines= $lines;
-
$name_tel;
-
#my @content = <TMPFILE>;
-
$temp;
-
$cur_line;
-
$prev_line;
-
$full_content;
-
foreach $temp(@lines)
-
{
-
# Searching Name and Telephone Number from the parsed text
-
# $temp = trim($cur_line);
-
$temp =~ s/^\s+//;
-
$temp =~ s/\s+$//;
-
chomp($temp);
-
$full_content .= $temp;
-
}
-
-
if ($cur_line ="~m/<h1> .+ </h1>/")
-
{
-
print $prev_line .",";
-
$name_tel .= $prev_line;
-
push(@name_tel, $prev_line);
-
$worksheet->write($row, 0, $prev_line); #Writing content in Excel Sheet
-
$col++;
-
}
-
-
if ($cur_line =~m/<p> .+ <br>/)
-
{
-
print $prev_line .",";
-
$name_tel .= $prev_line;
-
push(@name_tel, $prev_line);
-
$worksheet->write($row, 1, $prev_line); #Writing content in Excel Sheet
-
$col++;
-
}
etc..
I had written like this... Can anyone guide me in proceeding further..