Guys,

I have a script that reads a file line by line, looking for a start tag.

When it finds one, it jumps to a processing routing that continues through the file, 
line by line until it reaches an end tag.

Then it carries on looking for a start tag.

I have just found a scenario where a start tag occurrs before an end tag.

Initially, I thought I could simple use the start tag as an additional end tag, but 
the problem is that when it drops out of the processing loop, it will read the NEXT 
line of the file and miss the start tag.

Is there a way of pointing to the previous line of the input file if I detect a start 
tag?

Thanks,

R.

Sample code, untested.

open (INPUT, $myfile);

while (<INPUT>) {
   chomp;
   insert() if /Start Tag/;
}

sub insert {
   while (<INPUT>) {
      last if /Tag Stop/;
      if /Tag Start/ {
         somehow point to the previous line of INPUT
         so that the start tag will be found on returning.
         last;
      }
      do stuff;
   }
}
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to