go ahead... be a heretic | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You will be much better suited by using a proper parser than hoping to do the parsing through a regular expression. That said, it seems to me that you only want to replace variable names and not function names, so, barring any special/convenient notation for your variable names, I can only suggest that you build a proper regular expression out of your variable names:
You have two logic errors in your code: While your string still contains variable names, it makes no sense to try to evaluate it. Your code assumes that variable names should be matched independent of case, but your replacement can only replace the case that was stored in %cats. Your code will never replace blackCat with the value for blackcat. In reply to Re: Is there any way to ignore certain words and keep it as it is when substituing hash values to a matched pattern in a string?
by Corion
|
|