On Fri, 14 Jul 2006 12:00:08 -0700, you wrote: >I have something like this: > >while (<FILE>) >{ > if (/<TAG>/ .. /<\/TAG>/) > { > # process line > } >} > >I got this from http://www.perl.com/pub/a/2004/06/18/variables.html. > >My special wrinkle is, I want to process certain sections of a file, but >only if that section passes certain criteria. > >I want to be able to begin processing lines, but I want to be able to >turn processing off and jump to the next <TAG> should the script >encounter a line containing, say, the tag <PDF>.
There's no magic way to "reset" the range operator. You could add some sort of flag, such as this (untested): my $skip; while (<FILE>) { if (my $tags = /<TAG>/ .. /<\/TAG>/) { $skip = 0 if $tags == 1; # reset flag upon seeing <TAG> $skip = 1 if /<PDF>/; next if $skip; # process line } } Read the description in perlop for further details. You could also not use the range operator at all; I'll leave the code for that to you. -- Eric Amick Columbia, MD _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs