Hi monks,
I am working on converting a plain text file to html file.Now I have a scenario like below
#Assume the file is read to $str which contains
$str="iteration 1
some information goes here
machine name:[some meta-info]
some multi-line info
machine name:[some meta-info]
some multi-line info
iteration 2
some information goes here
machine name:[some meta-info]
some multi-line info
machine name:[some meta-info]
some multi-line info";
$str=~s/(iteration)(.*)/<B> uc($1)$2 <\/B>/;
print $str;
I expected the "iteration 1" and "iteration 2" to be "ITERATION 1" and "ITERATION 2", but its instead "uc(iteration 1)" and "uc(iteration 2)".
Please help me out to convert it into upper-case.Also any modules to convert plain text file to html would be helpful.TIA
ps: I know this can be done in passes by converting to uppercase in pass1 and adding tags in pass 2, but is it possible to achieve in a single substitution
The world is so big for any individual to conquer
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.