Larry Wall wrote:
=head1 Title
Synopsis 4: a Summary of Apocalypse 4
A little light reading is always good in the morning ;-)
I know it's probably just me, but This section seems to suddenly rely on a lot more knowledge of the current state of Perl 6 syntax than I have. Can someone walk me through these two examples?To return a value from a pointy sub or bare closure, you either just mention the value last that you want to return, or you can use C<leave>. A C<leave> by default exits from the innermost block. But you may change the behavior of C<leave> with selector adverbs:
leave :from(Loop) :label«LINE» <== 1,2,3;
The innermost block matching the selection criteria will be exited. The return value, if any, must be passed as a list. To return pairs as part of the value, you can use a pipe:
leave <== :foo:bar:baz(1) if $leaving;
What's a C<:from(Loop)>, for example, and how is C<:foo:bar:baz(1)> (what looks like a set of properties to me) related to pairing? Wouldn't that be:
leave <== 'a'=>'x', 'b'=>'y', 'c'=>'z' if $leaving
?
Thanks