Hi, I am sorry, I meant to say grep does not work inside a for loop.
regards, Satya ----- Forwarded by Satya Devarakonda/THP on 02/19/2002 05:18 PM ----- Satya_Devarakonda@tufts- health.com To: [EMAIL PROTECTED] cc: 02/19/2002 05:13 PM Subject: Grep function inside a for loop does grep the values. Can somebody help me on what is wrong in the following piece of code? foreach (@prv_lst) { $item = $_; @list_prv = grep (/$item/, @txn_log); print "The foll. are the Txn details for Trading Partner $item \n"; print @list_prv; for (@txn_lst) { $aprf = $_; $cnt = 0; @list_prv_txn = grep (/$aprf/, @list_prv); for (@list_prv_txn) {$cnt++}; print "The number of ${aprf}'s are ${cnt} \n" ; } } I dont see any values in the @list_prv eventhough I get one assiging a value to $item like $item = "abc"; -------------------- Thanks in advance, Satya -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]