in reply to Re^3: regex behaves differently in split vs substitute?
in thread regex behaves differently in split vs substitute?
The main idea of my reply to leslie was to avoid $1. The rationale is simple: $version is easier to understand than $1. This "if" before or at the end of the print is a side show, tangential to the point - makes no difference.
In general try to avoid $1 because almost surely there is some better name! Even if I am reading my own code one year later, I don't want to read the regex to see that I'm capturing digits...I'll see that I've got $version from the regex and my eyeballs keep moving in the code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: regex behaves differently in split vs substitute?
by Anonymous Monk on Oct 08, 2011 at 13:58 UTC | |
by AnomalousMonk (Archbishop) on Oct 08, 2011 at 18:43 UTC |