in reply to Re^2: Why is it uninitialized?
in thread Why is it uninitialized?

++Laurent_R ++dave_the_m: yeah, I didn't originally think it had to be anonymous, but perlref said "Closure is a notion out of the Lisp world that says if you define an anonymous function in a particular lexical context, it pretends to run in that context even when it's called outside the context." Maybe I'm just misinterpreting that (maybe always anon in Lisp? dunno). Or maybe the doc wasn't worded as carefully as it could have been. Thanks for the clarification.

Replies are listed 'Best First'.
Re^4: Why is it uninitialized?
by Laurent_R (Canon) on Dec 20, 2017 at 19:49 UTC
    I did not have time before. Just a short example of a named closure (an iterator) at the command line:
    $ perl -e 'use feature "say"; > { my $number = 0; > sub supply_square { > $number ++; > return $number ** 2; > } > } > say supply_square for 1..5; > say supply_square for 1..5; ' 1 4 9 16 25 36 49 64 81 100