Thanks for your suggestions Anonymous Monk, ww and jeffa. I had started with ww suggestion and modified by code as
if ( $form_dump_after =~ m{(<li>average_)(.*?)(</li>)}s ) { $inside_li = "average_".$2; print $fh "Value of \$inside_li: \n$inside_li \n"; }
It gave me output as:
average_speed_answer 25 60 30 60 ^M<br /> calls_waiting 300 500 300 500 ^M<br /> many more rows here post_ivr_calls_handled Wisconsin 50 100 50 100 ^M<br /> post_ivr_calls_handled Wyoming 50 100 50 100 ^M<br />
But I think I'll have to use HTML::TokeParser::Simple for the next tasks. I don't have HTML::TreeBuilder::XPath available and being in restricted env can't get it very easily, so can't check that out :-(

Some reference not related to this question directly: Actually all this that I am doing is for one simple goal, to be able to track the parameters (HTML form fields) that were changed from a dynamic web page. I am having hard time getting JavaScript to work and so took a very long path:

1. Took a snapshot of the DB fields that are displayed when the web page is fetched/loaded for first time.

2. Passed these fields in a hidden HTML form element, when the page is fetched/loaded for the first time

3. When the changes are made in the web page and form is submitted (when submit button is clicked) took a dump of all the paramaters passed using $query->Dump. This includes the hidden element which has the data before any changes were made in the form elements and the other normal paramaeters which has changes made by user.

4. And finally I am trying to put these two fields (before changes and after changes) in two arrays and compare the array elements to find the difference so I can get what fields were changed.

5. As of now, I am trying to make format of both arrays same so I can do the comparison.

If anyone knows a better approach then I would be glad to explore that. I'll post the update here when I'll finally be able to do it.

Thanks again!


In reply to Re: Query about regular expression by Perl300
in thread [Solved]: Query about regular expression by Perl300

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.