Bob - Thanks, I'll investigate that.
I'm also hoping that the list will tell me how to do it by incrementing the proper special variable. I could swear that I've done that before, and have found it useful in other contexts. -- Josh -- On 11/23/02 12:39 PM, "Mystik gotan" <[EMAIL PROTECTED]> wrote: > Use truncate() to hop to a 2nd line. The pattern match wil do. > > > > Sincerly, > Bob Erinkveld > (Webmaster Insane Hosts) > www.insane-hosts.net > > > > > >> From: Joshua Kaufman <[EMAIL PROTECTED]> >> To: <[EMAIL PROTECTED]> >> Subject: Match pattern and print next line >> Date: Fri, 22 Nov 2002 09:54:48 -0600 >> >> Hi All; >> >> I'm trying to match a pattern in a text file and then print out the next >> line in that file. I could swear that I've done this before by incrementing >> $. to move to the next line. However, the code below is printing out the >> matched line rather than the next line. >> >> #!/usr/bin/perl >> >> open (LOG, "./lmelog"); >> >> for ( <LOG> ) { >> if ( /- Student Id/){ >> ++$.; >> print "$_\n"; >> >> } >> } >> >> I really don't want to save the file into an array, given that it is > 10^6 >> lines long. >> >> Please cc me off list with any replies. >> >> Thanks in advance! >> >> Joshua R. Kaufman | Product Development Manager | Impart Knowledge >> Solutions, Inc. | 312-496-5669, x1003 >> >> >> >> -- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] > > > _________________________________________________________________ > Direct chatten met je vrienden met MSN Messenger http://messenger.msn.nl Joshua R. Kaufman | Product Development Manager | Impart Knowledge Solutions, Inc. | 312-496-5669, x1003 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]