in reply to given-when with compiled regular expression returned from method confusing behavior

From Switch statements:

Most of the time, when(EXPR) is treated as an implicit smart match of $_, i.e. $_ ~~ EXPR. (See "Smart matching in detail" for more information on smart matching.) But when EXPR is one of the below exceptional cases, it is used directly as a boolean:
Since $re->m1 is true, when ( $re->m1 ) succeeds.

UPDATE: I just noticed that the elided list is followed by

In those cases the value of EXPR is used directly as a boolean.
… in case you didn't believe it the first time, I guess. :-)

  • Comment on Re: given-when with compiled regular expression returned from method confusing behavior
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: given-when with compiled regular expression returned from method confusing behavior
by whakka (Hermit) on Dec 12, 2009 at 22:46 UTC
    Oh shoot somehow my eyes skipped over that part, thanks.

    Update: Harsh! The stress of hobby-coding when I have two finals next week are getting to me, I should really just do this when I have the time.

    Rejected witty excuses:

    • I guess you have to be smart to use smart-matching!
    • It seems the part where it says "These rules look complicated, but usually they will do what you want" doesn't really mean "...so go ahead and ignore the documentation."