![]() |
|
Perl-Sensitive Sunglasses | |
PerlMonks |
Re: make subroutine that takes expression as implicit block as first argby kennethk (Abbot) |
on Aug 13, 2010 at 19:46 UTC ( #854995=note: print w/replies, xml ) | Need Help?? |
You can accomplish your task using Prototypes. In fact, from the linked documentation, here's a reimplementation of the Perl grep operator: Update: Your example would be called as: print join ",", mygrep {$_ % 2 == 0} 0..10; Note the deviation from the proposed use case. I'd initially missed the spec for "automatically put [ting] it in an implicit block"
In Section
Seekers of Perl Wisdom
|
|