Hi,
I have a problem with perl matches. I am trying to read a xml file where I have to start reading when I see a patternThe pattern keeps changing every time in a for loop) and stop reading when I see another pattern( the sto p pattern remains the same)
Now the code I am trying is this.

while (<FILE>) { my $reading = 0; $reading++ if $reading; if(/.* ss:Name=\"$file*/oi){ # When we see <Appxxx> start storing the data print "VALUE IS $value \n"; $reading = 1; } $reading = 0 if (/<Row AutoFitHeight=\"0\">/); next unless $reading; print "$_"; }

here is the part of the file I am reading:

<Worksheet ss:Name="Appxxx"> <Table ss:ExpandedColumnCount="9" ss:ExpandedRowCount="4" x:FullColumn +s="1"> <Row ss:StyleID="s21"> <Cell><Data ss:Type="String">APPLES</Data></Cell> <Cell><Data ss:Type="String">GRAPES</Data></Cell> <Cell><Data ss:Type="String">TOWELS</Data></Cell> <Cell><Data ss:Type="String">NUMBER1</Data></Cell> <Cell><Data ss:Type="String">NUMBER2</Data></Cell> <Cell><Data ss:Type="String">NUMBER3</Data></Cell> <Cell><Data ss:Type="String">NUMBER4</Data></Cell> </Row> <Row> <Cell><Data ss:Type="Number">9</Data></Cell> <Cell><Data ss:Type="Number">0</Data></Cell> <Cell><Data ss:Type="Number">0</Data></Cell> <Cell><Data ss:Type="Number">0</Data></Cell> <Cell><Data ss:Type="Number">4</Data></Cell> <Cell><Data ss:Type="Number">126</Data></Cell> <Cell><Data ss:Type="Number">5</Data></Cell> <Cell><Data ss:Type="Number">144</Data></Cell> <Cell><Data ss:Type="String">01/24/2006-03:00</Data></Cell> </Row> <Row AutoFitHeight="0">

20060126 Janitored by Corion: Added formatting


In reply to match and read 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.