|Just another Perl shrine|
Re: Can I check if a loop's scope is entered for the first time? (functional approach)by LanX (Sage)
|on May 05, 2018 at 16:46 UTC||Need Help??|
FWIW this "works" somehow, but lacks the elegance of the "while solution" approach...
Please note that now, one can have more than just one loop var, like a "pointy block" in Perl6.
The cheat is that $a has to be global here to work under strict.*
Using my $a wouldn't work, because the scope only starts after the statements semicolon, and the body-sub is defined before.
Renamed loop to iter ... the loop construct in Perl6 is another beast, and wanted to avoid confusion.
*) remember $a and $b are global to allow sort to work.