Acadi asked:
> Just ( my ) terminology clean-up : in this example sub{ } is implicit
> topicalizer
No. It isn't a topicalizer at all.
> ( it does not set $_ explicitly )
Or implicitly.
> and you are setting $_ for perl .
Yes.
> that's why you can use "when" .
Yes.
is this valid ?
(morning() is function that analyse stringifyed time )
#!/usr/bin/perl -w
when ~time ~~ &morning { print "good morning" }
Yep. If C<when> is given a boolean, it acts like an C<if>
(except for the automatic C<break> at the end of its block.
and also
#!/usr/bin/perl -w
$_ = ~time
when &morning() { print "good morning" }
Almost. You want:
when &morning { print "good morning" }
(i.e. no explicit call parens)
Damian