|laziness, impatience, and hubris|
Re: help with a regexby 7stud (Deacon)
|on Feb 01, 2013 at 18:52 UTC||Need Help??|
Searches a string for a pattern, and if found, replaces that pattern with the replacement text and returns the number of substitutions made. Otherwise it returns false (specifically, the empty string).
All function calls in your code are replaced by their return values. Your code is essentially this:
When perl encounters the function call do_stuff(), perl halts execution of the print statement, then perl executes the function do_stuff(), then perl replaces the call to do_stuff() in your code with do_stuff()'s return value.
You could do this:
...but that's pretty ugly. I think the following are better alternatives:
The goal is code clarity--not cramming as much code into one line as possible.
Is there a reason you aren't putting the replacement text in the hash?