regex - Perl: Can I use capture groups in variables used in text replace regular expressions? -
Just for fun, I'm very new to Perl and I'm trying to write a simple text processing tool, But I 'm going to read the rules of the tool stuck in a simple thing, from a simple text file (not to the script, and perhaps it is important), to process a text file, there is an array of patterns / patterns in pairs (Like each for each process Yum line ). Here is the sub to apply the changes: My ($ text, @ rule) = @_; My @ lines = partition (/ \ n /, $ text); Forex Currency (@Rules) {My $ pattern = $ _- & gt; {"Pattern"}; My $ substituted = $ _- & gt; {"Substituted"}; $ Rows = map {$ _ = ~ S / $ pattern / $ substituted / g; } @ Lines; } Join the return ("\ n", @lines); For example, if there is a rule like pattern = [aeiou] + replace = * , then the text foo bar to F ** B * r . That's what i want Although I do not know why I can not use the capture group to change the text content, pattern = ([FF]) + in me Oh times I...