On Sat, Mar 4, 2017 at 9:22 PM, ToddAndMargo <toddandma...@zoho.com> wrote:

> I am coming frrom Modula2 here.
>
> I M2 (using Perl syntax),
>
>    sub A () {
>       sub B () {
>    }}
>
> B can only be seen inside A.  Outside of A, B is
> invisible.
>
> What are the rules for embedded subs in Perl 6?
>

subs default to "my" lexical scope and will behave as in Modula2, but you
can use "our" or an explicit namespace on the name to change it.

Note that in perl 5, subs are "our" scope and *not* lexical (but you can
specify an explicit namespace, and sufficiently recent perl 5 does support
explicit "my"/lexical scope).

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

Reply via email to