On Tue, Oct 06, 2015 at 08:57:50PM +0100, Dave Mitchell wrote: > On Tue, Oct 06, 2015 at 01:39:25PM -0400, Ricardo Signes wrote: > > * Dave Mitchell <davem@iabyn.com> [2015-10-06T12:03:30] > > > So for final clarity, is > > > > > > when (EXPR) {...} > > > > > > intended to always be exactly equal to > > > > > > if ($_ =~ EXPR) {...; break } > > > > Yes. > > > > > If so, how does one write something functionally equivalent to when(1) > > > now? > > > > when { $_ == 1 } { ... } > > But by the definition above, that is equivalent to > > if ($_ =~ ($_ == 1)) {...; break } when (FOO) { ... } becomes if ( $_ ~~ FOO) { ...; break } but when { FOO } { ... } # braces not parentheses becomes if ( FOO ) { ...; break } There's also postfix when { ... } TonyThread Previous | Thread Next