NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
In Perl 5 it would be 'sub { }', isn't it? (Score:1)
If the Counter / LazyIterator example was written in Perl 5, one would use '
sub { $count++ }', isn't it? Why the same method, i.e. 'sub { }' as circumfix operator for block in Perl 6?P.S. Would you resubmit this blog post to http://perlgeek.de/blog-en [perlgeek.de] for it to be easier to find?
Re:In Perl 5 it would be 'sub { }', isn't it? (Score:1)
If the Counter / LazyIterator example was written in Perl 5, one would use 'sub { $count++ }', isn't it? Why the same method, i.e. 'sub { }' as circumfix operator for block in Perl 6?
Yeah,
sub { }would be the nearest equivalent in Perl 5. It creates a reference to a closure. You can write that in Perl 6 as well, but thesubkeyword gives the closure a bit more of a "shell", as outlined in this post [perl.org].P.S. Would you resubmit this blog post to http://perlgeek.de/blog-en [perlgeek.de] for it to be easier to find?
If you want to read Moritz's and my blog posts in the same feed, I suggest you check out Planet Perl 6 [perl.org].
Reply to This
Parent