http://www.perlmonks.org?node_id=627817


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); }