It's not entirely clear to me
where you want your line numbers. If you just want them where a
:set number would put them, then you don't need to parse the file - the code is simple:
$cnt=1;
while (<>) {
print sprintf "%5d%s",$cnt++,$_;
}
Of course, that might make for some invalid HTML - like if a tag is broken across a newline (Frontpage seems to be fond of doing that).
If you're looking for numbers in the HTML after it has been rendered into text, look up HTML::FormatText.
If you want a number pre-prended to every line of the rendered HTML page in a browser, than I doubt you can do it. Particularly once tables get involved. Not because of the limitations of Perl, but because of the nature of HTML rendering.
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.