Hello,
I am new to perl and I need your help/advise. I have to
do the following:
1. Download a webpage that has currency rates against the
U.S. dollar (I was able to do this successfully).
2. Grep for the countries desired from a list.
3. Strip the sorrounding html tags from the desired name.
4. List and strip the subsequent five lines that have the
data related to that country.

For example,
html-tag html-tagEURhtml-tag html-tag
html-tag html-tagEurope (Euro)html-tag html-tag
html-tag html-tag1.1356html-tag html-tag
html-tag html-tag0.8806html-tag html-tag
html-tag html-tag0.7142html-tag html-tag
html-tag html-tag1.4002html-tag html-tag
html-tag html-tagCANhtml-tag html-tag
html-tag html-tagCanada (Dollar)html-tag html-tag
html-tag html-tag1.5901html-tag html-tag
html-tag html-tag0.6289html-tag html-tag
html-tag html-tag1.0000html-tag html-tag
html-tag html-tag1.0000html-tag html-tag

How do make it so that I pattern match for "EUR",
and get the next 5 lines of data, then strip away
the html tags to make the output look like this:

EUR,1.1356,0.8806
CAN,1.5901,0.6289



Thanks,
bembe0417

In reply to How to match pattern and next 5 lines? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.