|Just another Perl shrine|
Is there a more functional regex syntax?by smls (Friar)
|on Sep 18, 2012 at 15:29 UTC||Need Help??|
smls has asked for the
wisdom of the Perl Monks concerning the following question:
Consider the example of having as input a list of numbers, some of which are not known exactly but only known to be inside a given range (that is encoded in a string value).
The following code snippet adds up the given numbers, returning an upper and lower bound for the result:
It works fine, but regarding the regex part, the need to
I would much prefer to be able to write the whole body of the of loop in the above example in the form:
Is there an alternative syntax for string extraction using regexes that would allow this?
It's not about performance or such. It's about my brain receiving a nice dose of dopamin whenever I write a line of concise, functional, self-contained code - and the opposite when I can't.