Hi, In short, I have a defined set of pattern that can occur across any number of lines(scalars) in a buffer (array of scalars) and I need to print only those lines(Scalars) that contain the full or partial pattern. For eg. For the buffer @buff (as shown below), I have to find out the occurance of "FastEthernet" and "down".
I have pasted a code below : I join the buffer to make a Scalar and then search for the pattern. ******************************************************************************************** my @buff; $buff[0] = "Jul 5 03:22:29.635 cst: SNMP: 10.1.0.1 queue overflow, dropping packet\n"; $buff[1] = " ifEntry.1.13 = 13\n"; $buff[2] = " ifEntry.2.13 = FastEthernet3/9\n"; $buff[3] = " ifEntry.3.13 = 6\n"; $buff[4] = " lifEntry.20.13 = administratively down\n"; $buff[5] = " ifEntry.2.13 = FastEthernet3/9\n"; $buff[6] = " ifEntry.3.13 = 6\n"; $buff[7] = " lifEntry.20.13 = administratively down\n"; $temp = join($",@buff); if($temp =~ /FastEthernet(\n|\d|\w|\.|\/|\s|=)*down/i) { print "MATCH found\n"; } *********************************************************************************************** Now, that the match has been found, I just want to print only those scalars in @buff which contains the specified pattern. The print should be ifEntry.2.13 = FastEthernet3/9 lifEntry.20.13 = administratively down Regards Rajeev -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]