Craig Cardimon wrote:
> I need to read a large text file line by line until a certain tag is
> found, say <TAG>. This tag will exist on a line by itself. Then I need
> read in all subsequent lines, appending them to each other, until the
> ending tag </TAG> is found, again on a line by itself.
>
> My logic, if you can call it that, looks like this:
>
> TAGAREA: while(<IN>)
> {
>
> if(m/<TAG>/i .. m/<\/TAG>/i)
> {
> $tagarea = $tagarea . $_ ;
> }
>
> next TAGAREA unless defined $tagarea;
> }
>
> I also have a variety of other screen-out tests I perform on $tagarea.
> If that variable contains any no-no's, I move on to the next TAGAREA.
>
> That's the theory, anyway. The logic isn't functioning. Where am I
> going wrong?
Works for me. What is the point of the "next" statement at the end?
When it hits the end of the block, it's going to do an implicit "next"
operation anyway.
What behavior are you seeing? Is there more code that you aren't
showing us?
--
Bowie
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs