Howdy akamboj84,
In the replacement part of your regex, $dic{$matchkey} will always be undefined. $matchkey is the variable you defined above by joining all the keys in %dic, and is therefore not itself a key of %dic. What you actually meant was:See the relevant section of perlvar.$line =~ s%$matchkey%$dic{$&}%g; # Use the matched string as a key +in $dic $line =~ s%($matchkey)%$dic{$1}%g; # Same as above without the perfor +mance issues of $&
In reply to Re: Multiline Regex replacement in Multiline file
by Grimy
in thread Multiline Regex replacement in Multiline file
by akamboj84
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |