in reply to Re: Regex Subexpressions
in thread Regex Subexpressions

Wow!  Now that's a great answer!

Let me just add the following, since it took me a few minutes to see exactly what you were doing, as well as making it conform to the original requirements for the output:

$_ = "abc"; # Regex match of /.../ uses $_ when =~ is unspecified # Nicely solves the problem stated, and demonstrates list assignment # to a regex capture. # @matches = m/(((a)b)c)/ and print join "\n", reverse @matches;
I realized a "reverse" was necessary, and then immediately fell into the trap of putting it before the "join".  I like your answer a lot for its succinct approach!

Replies are listed 'Best First'.
Re^3: Regex Subexpressions
by ikegami (Patriarch) on Sep 10, 2005 at 03:52 UTC
    Does your solution have to find "ab" in "abd"? If so, the above won't work.