On Thu, Jun 13, 2002 at 03:48:25PM -0700, Larry Wall wrote:
> But the most straightforward way to match longest is probably to use
> :any to get a superposition of matches, and then pull out the longest
> match.  

So, does :any return a list of the substrings that matched or a list
of match objects?  Or some polymorhpic thing that can be either?
Would something like this work?

        rule max ($pat) {
           $0 := {
                reduce { length $^a > length $^b ?? $^a :: $^b } <:a $pat>;
           }
        }

        "bacamus" =~ m/<max b.*a | b.*s>/;

-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to