in reply to My my

Hello Saxium, and welcome to the Monastery!

The following quote from perlsub may throw a little more light on the answer given by roboticus:

A my has both a compile-time and a run-time effect. At compile time, the compiler takes notice of it. The principal usefulness of this is to quiet use strict 'vars', but it is also essential for generation of closures as detailed in perlref. Actual initialization is delayed until run time, though, so it gets executed at the appropriate time, such as each time through a loop, for example.

So the rationale behind the behaviour described by roboticusThe printme subroutine uses the ... [$x] in scope at the point where it's compiled. — is to facilitate closures as a feature of Perl. Here are some references on closures, in case you’re interested:

Excellent question, by the way!

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,