good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Can I check if a loop's scope is entered for the first time? (functional approach)by LanX (Saint) |
on May 05, 2018 at 16:46 UTC ( [id://1214097]=note: print w/replies, xml ) | 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.
Cheers Rolf
updateRenamed 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.
In Section
Seekers of Perl Wisdom
|
|