Thank you for the reply. The file I am processing is a html file and I am using HTML::Parser to process it. Also I am having trouble understanding you helpful reply. I am using HTML::Parser like so ...
my $p = HTML::Parser->new( api_version => 3,
start_h => [\&start, "tagname, attr"],
end_h => [\&end, "tagname"],
text_h => [\&text, "dtext"],
marked_sections => 1,
);
# Parse directly from file
$p->parse_file($inputFile);
... so I have a sub text() that looks like this ...
sub text {
my($origtext, $is_cdata) = @_;
if ( $origtext =~ /^\s*$/ ) { return; }
$origtext = "UNDEF" if !defined $origtext;
$is_cdata = "UNDEF" if !defined $is_cdata;
$origtext =~ s/ \& / \& /g;
$origtext =~ s/½/\½/g;
print $origtext;
}
... so when should I do the "local $/;" call?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.