Hello All,
This might be a very round about question to pose but the tag line of PERL monks says stupid most question is question not asked!! I have a code where I am matching lines in if else block. If the line matches to the pattern in the if block it performs some task. Same is for elsif blocks too. Finally if the line does not match to any of these it sends it to else block printing it as error. I want to know exactly where the pattern did not match the given line in the loop. Is there any efficient and less costly way to find this?
if($a=~/ABC\s+XYZ/){ #do something }elsif($a=~/PQR\s+LMN/){ #do something }else{ print "Error\n"; #Want to know where exactly did the regex in above checks failed OR ne +ed to tell the user that your query failed at this particular place. }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |