in reply to
Re^3: Is there a more functional regex syntax?
in thread Is there a more functional regex syntax?
The regex suggested by tobyink above can make the single-line case much more readable
The advantage of mine is that it actually enforces format, which may or may not be of concern. I also like that you expect two values and you get two values; a little less slight of hand for maintenance. But I do appreciate the elegance of his choice of indices.
Also be aware you'll need to initialize @totals = (0,0) so that the index -1 doesn't map to your first term. tobyink does it, but didn't really emphasize its importance.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.