Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Regex capture consumed by non-capturing match

by ribasushi (Pilgrim)
on Jul 20, 2007 at 15:55 UTC ( [id://627817]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Regex capture consumed by non-capturing match
in thread Regex capture consumed by non-capturing match

Yes, except that it is quite hard to write an if that checks if the match succeeded at all. I omitted this in the example, but in the real code this was the case:
if ($string =~ /re/) { my ($a, $b, $c) = trim_func ($1, $2, $3); }

Replies are listed 'Best First'.
Re^4: Regex capture consumed by non-capturing match
by ikegami (Patriarch) on Jul 20, 2007 at 16:29 UTC

    Not so.

    if (my @matches = $string =~ /re/) { my ($a, $b, $c) = trim_func(@matches); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-03-19 11:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found