Gary To grab the lines between tags and include the tags then you can use code like the following:- open(HTM, "file_to_scan.txt"); @lines = <HTM>; close(HTM); $longline = join "\n", @lines; $longline =~ s/(<form(.*?)\/form>)//si; print $1; $result = $1; $result now contains the first match in the file or is printed to whereever you want. Repeat $longline =~ s/(<form(.*?)\/form>)//si; for subsequent matches in the same file as often as required - probably you would use a while loop if you are expecting multiple matches. hth Andy > > > ----- Original Message ----- > From: "Gary Nielson" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, April 16, 2001 2:28 PM > Subject: Whoops! CLARIFICATION: Reading a file from point A to B > > > > I should correct my previous posting to say that I mean I need to capture > > all lines in-between start and end tags, not just the second line in the > > example below. I amended below for clarity. > > > > On Mon, 16 Apr 2001, Gary Nielson wrote: > > > > > Hi, > > > > > > I am trying to figure out the best way to read a file from point A to > > > point B. For example, I have a file with many specialized tags that > start > > > on one line and then the end tag is a few lines down and I want to be > able > > > to 1) recognize when the tag starts, 2) grab all the content in-between > > > the tag. > > > > > > When reading a file, I understand how to grab a line of text and > > > manipulate it, as well as grab a paragraph of text. I was reading in the > > > Perl Cookbook about $/ and how that is used. I do not know if that's the > > > appropriate special variable for this type of action. > > > > > > For example, if in the middle of an html document, I encounter the > > > following: > > > > > > <SNML_BYLINE> > > > <CENTER><B>By SOMEONE'S NAME </B></CENTER><P> > > > <CENTER><I>Contributor </I></CENTER><P> > > > </SNML_BYLINE> > > > > > > How do I recognize the beginning SNML_BYLINE tag, stop at the end > > > </SNML_BYLINE> tag and grab all the lines in-between and put them in > > a> special variable? > > > I must keep in mind that there could be anywhere from 1 to many > > > lines in-between the start and end tags. > > > > > > Any help appreciated. > > > > > > > > > > -- > > Gary Nielson > > [EMAIL PROTECTED] > > > > > > > > > > _______________________________________________ > > Perl-Win32-Users mailing list > > [EMAIL PROTECTED] > > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users > > > > > _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
