2022-4-4 19:27 Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote: > Yuki Kimoto <kimoto.yuki@gmail.com> writes: > > > I ask a question about yield_true feature. > > > > This example seems to be adding "1;" to the end of the file scope. > > > > Can yield_true feature be implemented actually as a file scope, not as a > > global scope? > > All features (as in feature.pm) are lexically scoped, the file scope is > just the top-level lexical scope. This implies that doing `use feature > 'yield_true';` in a non-toplevel scope, i.e. inside a sub or other > block, has no effect, since the feature will not be enabled anymore at > the end of the file scope. > > - ilmari > Thank you for your reply. Can I understand the yield_true feature as the following example? { use feature 'yield_true'; { print "Hello'; } } is same as { { print "Hello'; } 1; }Thread Previous | Thread Next