Hi,
I am a newbie to PERL. I require your guidance for the
following problems. Any suggestions are appreciated.
1.I have this following piece of code, but I am unable to
get the required chunk of data i.e. the values between
<br>color="BA3B38"> and
</td></tr>. But I am unable to get
past the first
in the first line. I tried
removing \n using translation $content =~ tr
\n[]d;
but still program didn't work.
$content='<td valign="top" align="justify"><font face="arial" size="2"
+ color="BA3B38">Java and databases make a powerful combination. <br>
Getting the two sides <br>
to work together <br>
Takes some effort to work together
JDBC 2 javax.SQL
</td></tr>';
$content =~ m{<td valign="top" align="justify"><font face="arial" size
+="2" color="BA3B38">([.*?]+)<\td><\tr>};
print "$1\n\n";
2. I have the following chunk of code. In this I require UK
Pound and price and USD and its respective price. The
problem we are facing is we are unable to get the price
(i.e. number 12 and 27) portion and in this is
also we are facing new line character problem when
trying to extract the whole chunk and process values one by one.
<tr><td><font face="verdana" size="1"><b>Product Name</b> </td><td>:</
+td>
<td><div align="justify"><font face="verdana" size="1">Queen of Al
+ls</div></td>
<td rowspan="5" valign="top"><img src="pictures/queen.gif"></td></
+tr>
</tr>
<tr><td><font face="verdana" size="1"><b>Price(UK Pound)</b></td><td>:
+</td>
<td><font face="verdana" size="1">12.00</td></tr>
<tr><td><font face="verdana" size="1"><b>Price($)</b></td><td>:</td>
<td><font face="verdana" size="1">$27.27</td></tr>
<tr valign="TOP"><td><font face="verdana" size="1"><b>Description</b><
+/td><td>:</td></tr>
3."Parsing of undecoded UTF-8 will give garbage when
decoding entities at D:/Perl/site/lib/LWP/Protocol.pm
line 114."
Any solution to this problem.
Thanks,
Sugar
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.