Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Is there a more functional regex syntax?

by smls (Friar)
on Sep 18, 2012 at 16:42 UTC ( #994311=note: print w/ replies, xml ) Need Help??


in reply to Re: Is there a more functional regex syntax?
in thread Is there a more functional regex syntax?

Nice trick using the -1 index like that, I'll have to remember that...

Regarding the original question though, I was hoping for a solution that keeps the regexes, because even if replacing them with split is possible in this case, that won't always be feasible if dealing with more complex regexes.


Comment on Re^2: Is there a more functional regex syntax?
Re^3: Is there a more functional regex syntax?
by tobyink (Abbot) on Sep 18, 2012 at 16:57 UTC

    Some regexes will work inside those parentheses.

    $totals[$_] += ($range =~ /(\d+)/g)[$_] for 0, -1;
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994311]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (13)
As of 2014-12-18 22:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (67 votes), past polls