Dec 15, 2015, 12:49 PM
If /$i/ and /CORP-GOLD-NETAPP_LEGAL1-NDMP/ produce different results, they must be different. You have shown that $i comes from one line of @line1 which you read from a file. Every line of a file (and therefore $i) ends with a newline. Your fixed regex does not. You must fix this. It would be wild speculation to say that this is the only difference. Fishmonger and myself have both said we need code and data. In order to debug your problem, we must be able to reproduce it on our own machines. We do not need much data and it does not have to be real, but it must demonstrate the problem.
Re: [regex2012] additional question
Note: Your use of while and if rather than grep is probably a good idea, but it does nothing to solve the problem. You must get the regex right in either case.
UPDATE: See Cris's reply to http://perlguru.com/gforum.cgi?post=82439;. I think you could adapt it to your problem.
(This post was edited by BillKSmith on Dec 16, 2015, 6:45 AM)