in reply to Re^2: performing operation on elements not in list?
in thread performing operation on elements not in list?

Good catch regarding the anchors and alternation. The OP says "given the same ... list" so the keys not to change are invariable. So I should have said.

$inv = do{ local $" = q{|}; qr{^(?:@{ [ qw{ two three } ] })$} };

I'm not sure what you mean when you say I don't convert the keys to regexp.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^4: performing operation on elements not in list?
by ikegami (Patriarch) on Jan 09, 2009 at 22:13 UTC

    So I should have said.

    No, that's insanely complex for a static pattern.

    Also, I prefer to put the anchors in the parent regexp. It makes more sense conceptually, the code pattern work in more situations, and you don't have to add (?:) since qr// adds one for you.

    I'm not sure what you mean when you say I don't convert the keys to regexp.

    Injection bug. See the addition of quotemeta in the last two snippets.

Re^4: performing operation on elements not in list?
by ikegami (Patriarch) on Jan 09, 2009 at 22:15 UTC

    So I should have said.

    No, that's insanely complex for a static pattern.

    Also, I prefer to put the anchors in the parent regexp. It makes more sense conceptually, the code pattern work in more situations, and you don't have to add (?:) since qr// adds one for you.

    I'm not sure what you mean when you say I don't convert the keys to regexp.

    Injection bug. See the addition of quotemeta in the last two snippets.