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.
- a subroutine or method call
…
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. :-)
|
|---|
| 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 |